0

Why is it that logical operators don't work with user input?

For example: >>> a = input() False >>> q = not a >>> print(q) False >>> print(not False) True

25th Jun 2017, 7:00 AM
Erik Johanson
Erik Johanson - avatar
2 Respostas
0
not sure, but I think a string when checked for true/false is equal to true if it contains characters
25th Jun 2017, 9:12 AM
Daemo
Daemo - avatar
0
Because the user input is a string type and not a logical type. Reread the beginning of the Python course about setting variable values and then use conditional statements like if to set variables of a logical type to match the user input value.
16th Oct 2017, 8:01 AM
GW III