0
Why only last statement gets executed
2 Respuestas
+ 1
By default, the input() function returns a String type, so you are trying to compare a String to an integer, comparing two different variable types is not allowed without manipulation, so you can either declare x as an integer, or change each number operand in your if/elif statements to a String.
If you want to compare two integers you can do that by replacing the first line with
x = int(input())
or if you want to compare two Strings, leave the first line as you have it and put single quotation marks around each number operand IE:
if x == ‘7’:
+ 6
You need to convert input to int else it compares the input which is just a string '7'==7
x=int(input())