0

I can't understand the bug

I can't understand why do output is nothing https://sololearn.com/compiler-playground/cJy83L6tB1IH/?ref=app

5th Sep 2025, 9:31 PM
Sourjo
Sourjo - avatar
2 Risposte
+ 5
you are comparing choice to numbers. input is string. they will never be equal. choice == 1 but if i input 1, it is actually '1' '1' == 1 will always be False so you have to either convert input to int or compare to string. choice = int(input()) or choice == '1'
5th Sep 2025, 9:51 PM
Bob_Li
Bob_Li - avatar
+ 3
If you convert the input to integer like this... choice = int(input()) ....then it works.
5th Sep 2025, 9:50 PM
Jan
Jan - avatar