Code Coach: Fruit Bowl | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code Coach: Fruit Bowl

I need help understanding this problem. I did look up the answer because right now I'm struggling to understand basic problems and really frustrating to me because I want to understand Python. You have a bowl on your counter with an even number of pieces of fruit in it. Half of them are bananas, and the other half are apples. You need 3 apples to make a pie. Task Your task is to evaluate the total number of pies that you can make with the apples that are in your bowl given to total amount of fruit in the bowl. Input Format An integer that represents the total amount of fruit in the bowl. Output Format An integer representing the total number of whole apple pies that you can make. Sample Input 26 Sample Output 4

8th Feb 2024, 2:56 PM
Nicole Krason
9 Answers
+ 6
My apologies Nicole Krason, I read your question again and my answer wasn't relevant so deleted. So for input, You have variable named "fruit = int(input())". Int -> will take input as integer and you have input() function to take user input. If you have saved the code, when you open the code and run it. There will be input dialog box, when you have to input number (say its-> 12) And from the given input number of 12, and floor division math you did for Apple and Pie Python will calculate and give you output.
8th Feb 2024, 3:18 PM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar
+ 6
Floor division is a mathematical operation that "rounds down" the result of a division operation "to the nearest integer." you do not have to know what pieces are for fruit, because you are inputting those numbers. In the given task it's 26
8th Feb 2024, 3:26 PM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar
+ 1
D Shah 🎯⏳️ no worries ☺️ Floor division is just getting how many times a number can go into another number, not looking at remained. I think what trips me up is not knowing how many pieces of fruit are in the bowl to begin with.
8th Feb 2024, 3:21 PM
Nicole Krason
+ 1
D Shah 🎯⏳️ okay, that makes sense. Thank you!
8th Feb 2024, 3:30 PM
Nicole Krason
+ 1
Nicole Krason , Thanks for including the link to the Code Coach description. I wish everyone did that.
9th Feb 2024, 8:55 AM
Rain
Rain - avatar
+ 1
Rain of course! When I need help, I want to share everything so there's no confusion ☺️
9th Feb 2024, 12:07 PM
Nicole Krason
8th Feb 2024, 2:58 PM
Nicole Krason
0
fruit = int(input()) apple = fruit // 2 pie = apple // 3 print(pie) I'm not understanding how this all comes together
8th Feb 2024, 2:58 PM
Nicole Krason
0
D Shah 🎯⏳️ this code worked when I ran it. The problem is asking for input and output
8th Feb 2024, 3:11 PM
Nicole Krason