0

How come this code has an error?

siblings = int(input()) popsicles = int(input()) #your code goes here if(popsicles / siblings = 0){ print("give away") } else{ print("eat them yourself") } Aparently Popsicles can't be divided by siblings like that, cause it says there's an error

10th Jan 2020, 2:48 AM
Potato
7 odpowiedzi
+ 2
Remember that you don´t need to have the same amount of pops and siblings to make the code print "give away", you need the REMAINDER to be 0. That might be a good clue. Also the remainder should be 0 if you have more popsicles than siblings, or if you have more siblings than popsicles to be able to give them away.
10th Jan 2020, 6:25 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 4
Potato it's not Java(you can't use curly brackets) remove them
10th Jan 2020, 3:31 AM
Abdol Hashimi
Abdol Hashimi - avatar
+ 4
Potato it should be like this siblings = int(input()) popsicles = int(input()) #your code goes here if(popsicles / siblings == 0): print("give away") else: print("eat them yourself")
10th Jan 2020, 3:32 AM
Abdol Hashimi
Abdol Hashimi - avatar
+ 3
in the fourth line if(popsicles/siblings=0) Use (==) for checking equality you have used (=)
10th Jan 2020, 3:00 AM
Abdol Hashimi
Abdol Hashimi - avatar
10th Jan 2020, 5:40 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Thanks everyone!
26th Jan 2020, 5:44 AM
Potato
+ 1
Sorry but it didn't work
10th Jan 2020, 3:15 AM
Potato