+ 1

What is the bug of this code??

fruit = int(input()) if fruit%3 == 0: print(fruit/3) else: print("0") #your code goes here

2nd Sep 2021, 1:53 PM
Abdullah Al Abid
Abdullah Al Abid - avatar
15 Answers
+ 10
Fruit bowl? All you need to divide variable fruit by 6 using floor division `//`
2nd Sep 2021, 3:56 PM
Simba
Simba - avatar
+ 8
print(0) instead of print("0")
2nd Sep 2021, 3:01 PM
Oma Falk
Oma Falk - avatar
+ 4
Abdullah Al Abid Your question always printed 0 because You tried to set a equation of "if fruit // 3 == 0 :" which made it always print 0 but I just declared a variable "declare" to contain fruit // 3 in one variable so that it would be easy to solve it your code was right but the error occurred because of if statement having the equation Happy Coding! 😊
2nd Sep 2021, 3:59 PM
<★Shaurya Chauhan★>
<★Shaurya Chauhan★> - avatar
+ 4
Calvin [Inactive] I didn't completely understand But sounds interesting. Could u explain in detail please?
3rd Sep 2021, 7:45 AM
Oma Falk
Oma Falk - avatar
+ 4
Do fruit divided being like this in close fruit //3
3rd Sep 2021, 10:49 AM
Ermias Kebede
Ermias Kebede - avatar
+ 3
I got it. Thanks a million all of you ....
2nd Sep 2021, 4:28 PM
Abdullah Al Abid
Abdullah Al Abid - avatar
+ 3
fruit = int(input()) if fruit%3 == 0: print(fruit//3) else: print("0")
3rd Sep 2021, 1:13 AM
Abhishek Kumar
Abhishek Kumar - avatar
+ 2
result : input = 4 my code answer = 0 Showing answer = 0 although my code answer = showing answer; It is showed that my answer is not fully correct....
2nd Sep 2021, 3:00 PM
Abdullah Al Abid
Abdullah Al Abid - avatar
+ 2
Could you specify the task name and the course ? I believe it is related to your float division (fruit/3)
2nd Sep 2021, 3:17 PM
Hima
Hima - avatar
+ 1
Hi Abdullah Al Abid https://code.sololearn.com/c4HVEZq9ah9c/?ref=app See this is answer If any doubts then ask Me Happy Coding!
2nd Sep 2021, 3:17 PM
<★Shaurya Chauhan★>
<★Shaurya Chauhan★> - avatar
+ 1
Tnx a lot. But it is also same, right??
2nd Sep 2021, 3:54 PM
Abdullah Al Abid
Abdullah Al Abid - avatar
+ 1
I think, there are not any special bugs. Because of coding isnot a game. You must coding by your knowledge. May be, there are bugs, but I dont know. This is my opinion
4th Sep 2021, 7:26 AM
Shuhratxon Izatullayev
Shuhratxon Izatullayev - avatar
0
Float
4th Sep 2021, 10:25 AM
Mohamed Bilow Mohamud
Mohamed Bilow Mohamud - avatar
- 1
Print("0") ; 📜
4th Sep 2021, 5:40 AM
Shubham Bhatia
Shubham Bhatia - avatar
- 2
G
3rd Sep 2021, 10:02 PM
Jeremy Sanchez