0

val = input("how many players") if val == 1: print("you are going to bat") else: print("choose ur field")

The above question is the one which i have tried when i give the val value as 1 its displaying the else part choose ur field but actually i have to get the if part but not getting may i know the reason plz guys help me to solve this....

15th May 2020, 11:06 AM
P.saradha
P.saradha - avatar
1 Réponse
+ 3
try val = int(input(.....)) or, val = input(....) if val == "1": .... ........ because input() takes only strings and you can't just compare strings with integers.
15th May 2020, 11:09 AM
M Tamim
M Tamim - avatar