+ 1

Popsacles Aufgabe

Hallo, bin noch neu dabei aber vllt kann mir einer bei folgendem helfen: def pops(siblings,popsicles): siblings=int(input(siblings )) popsicles = int(input(popsicles )) if popsicles % siblings==0: return('give away') else: return('eat them yourself') print(pops(2,5)) Ich bekomme hier neben dem gewünschten Ergebnis immer zusätzlich davor eine 25- weiß einer warum?

5th Aug 2025, 7:12 PM
Koljo
Koljo - avatar
3 Respostas
+ 2
don't complicate your code. just use 2 inputs, create a variable that stores a result, and use a comparison. I hope this helps
5th Aug 2025, 7:31 PM
Mihaly Nyilas
Mihaly Nyilas - avatar
+ 1
Koljo , some issues that should be fixed: > the call of the function `pops(2,5)` is done with 2 hard coded values. this is not correct. remove them. > also remove the arguments from the function header > for output in code coaches, only the required values should be used. so do not use any arguments inside input() functions. > the values 2 and 5 appear as output, because in your current code these values are given as arguments to the parameters in the function header. the input() functions are using these parameters as a user prompt.
5th Aug 2025, 7:25 PM
Lothar
Lothar - avatar
+ 1
Ok thank you really much, i corrected it now and it works fine
5th Aug 2025, 8:12 PM
Koljo
Koljo - avatar