+ 1

# Popsicles issue

#My solution to popsicles using python siblings = int(input()) popsicles = int(input()) #your code goes here math = popsicles / siblings if math % 2 == 0: print('give away') else: print('eat them yourself') The last problem fails and I don't understand why?

6 ответов

+ 6

Mike ,
your *final* code has some duplication. i have taken this code and just only commented out the not required lines. so the code runs properly and has a quite good readability. you can remove all lines that starts with `#`:
siblings = int(input())
popsicles = int(input())
#your code goes here
#if popsicles > siblings:
if popsicles % siblings == 0:
print('give away')
else:
print('eat them yourself')
#elif popsicles < siblings:
# print('eat them yourself')
#else:
# print('give away')

+ 2

we need to know if x%y == 0, not if (x/y)%2 == 0

+ 1

suppose we have 9 popsicles and 3 siblings. each siblings would get 3 popsicles.
we need to know whether the number of popsicles is divisible by the number of siblings.
Lothar thanks 😊

+ 1

Yeah I get that, but that's what I thought I wrote
#Divide popsicle between sibs
Math = popsicles / siblings
#then if the answer of math is even or = 0 they get pops
If not, I'm greedy?
I don't understand what is wrong as I can't see the final error I feel like its staring me in the face 😂

0

Ohh I hate math 😞😂 thanks both!

0

siblings = int(input())
popsicles = int(input())
#your code goes here
if popsicles > siblings:
if popsicles % siblings == 0:
print('give away')
else:
print('eat them yourself')
elif popsicles < siblings:
print('eat them yourself')
else:
print('give away')
SOLVED
May not be the most accurate way, but it worked just could not get the last one 🤔 would help if I could see the inputs