MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PythonLearning/comments/1wfbsia/what_wrong_with_my_code/p9l2737/?context=3
r/PythonLearning • u/ApprehensiveText9058 • Sep 13 '26
Need help
40 comments sorted by
View all comments
0
You shouldn't put the : after the if, i explain: you wrote if: choice=='2': that will be a sintax error. The : shall be after the 2, and moreover. The 2 shall be an integer, not a string. I hope this help you
2 u/flofoi Sep 13 '26 no, "2" is correct, choice is a string 1 u/One_Park8163 Sep 13 '26 I know but choice shall be a integer, int(input()). Is a good practice but the code will work too as a string 2 u/flofoi Sep 13 '26 you're right, it should be casted to int. But that requires error handling and then the code won't fit on the tiny screen anymore
2
no, "2" is correct, choice is a string
1 u/One_Park8163 Sep 13 '26 I know but choice shall be a integer, int(input()). Is a good practice but the code will work too as a string 2 u/flofoi Sep 13 '26 you're right, it should be casted to int. But that requires error handling and then the code won't fit on the tiny screen anymore
1
I know but choice shall be a integer, int(input()). Is a good practice but the code will work too as a string
2 u/flofoi Sep 13 '26 you're right, it should be casted to int. But that requires error handling and then the code won't fit on the tiny screen anymore
you're right, it should be casted to int. But that requires error handling and then the code won't fit on the tiny screen anymore
0
u/One_Park8163 Sep 13 '26
You shouldn't put the : after the if, i explain: you wrote if: choice=='2': that will be a sintax error. The : shall be after the 2, and moreover. The 2 shall be an integer, not a string. I hope this help you