+ 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
9 Respostas
+ 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.
+ 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
+ 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.
+ 1
D Shah 🎯⏳️ okay, that makes sense. Thank you!
+ 1
Nicole Krason ,
Thanks for including the link to the Code Coach description. I wish everyone did that.
+ 1
Rain of course! When I need help, I want to share everything so there's no confusion ☺️
0
fruit = int(input())
apple = fruit // 2
pie = apple // 3
print(pie)
I'm not understanding how this all comes together
0
D Shah 🎯⏳️ this code worked when I ran it. The problem is asking for input and output