+ 1
Fruit Bowl code question Python
Hi! I need help with this code in Python. I don't know why this don't work. Could you help me, please? Fruit=int(input()) def pie(x): num=0 total_pies = 0 apples = x // 2 for i in range(1,apples +1): num=num+1 if num==3: total_pies=total_pies+1 num=0 return total_pies pie(fruit)
2 ответов
+ 10
Abi ,
there are 2 issues:
▪︎ define fruit in lower case:
=> fruit=int(input())
▪︎you call the function, but you do not take and output the returned value coming from the function.
you can do this:
=> print(pie(fruit))
+ 3
Lothar thank you!
fruit was in lower case, I changed it when transcribing!
But the problem was that I didn't print it! Thank you so much, now it works!