Home > other > [small white consult post] the if function USES about Python
[small white consult post] the if function USES about Python
Time:09-29
As is shown above, I can not judge in Chinese red box
CodePudding user response:
No permissions correction, image upload repeated
CodePudding user response:
Problem #
Write guess=int (temp) what is the purpose?
# a solution
Temp=input (' who is your favorite? ') Guess=int (temp)
Change
Guess=input (' who is your favorite? ')
CodePudding user response:
Not red box where you can't use Chinese to judge, but guess=int (temp) when there is a problem! If you run the program input is "I", when the temp is a non-numeric character string, it must be not casts! Obtained through input variable values and make the int (temp) is the premise of not an error, the temp must be a pure integer (even no floating point) in the form of a string,