0

I'm doing the fruit bowl quiz in Python but I don't understand why it is not working.

Here is my code fruit = int (input()) pies = int ((fruit / 2) // 3 ) if fruit % 2 == 0: print (pies) else: print ("The number of fruits must be even!!") The code passes the 2 first test chases and fails the 3 last. Any ideas?

9th Oct 2022, 6:33 PM
Georg Karadimas
3 Answers
+ 4
Georg Karadimas , the first 2 lines in the code are ok. in the second line all calculation that is required is done correctly and then stored in the variable `pies`. we need just to print this result, without any use of if... else... so the final code for you is just 3 lines.
9th Oct 2022, 7:54 PM
Lothar
Lothar - avatar
+ 2
Thanks for your help
10th Oct 2022, 7:07 AM
Georg Karadimas
0
Thanks a lot.
9th Oct 2022, 7:55 PM
Georg Karadimas