Jan-13-2021, 07:31 PM
Hi, I'm self-taught Python. I use version 3.9.
I wrote simple code to learn how to use the "if" and "else" conditionals, and they worked, but I tried to write more complex code, following my previous examples, and it indicates that there is a syntax error.
Could you help me identify and understand my mistake, please?
I wrote simple code to learn how to use the "if" and "else" conditionals, and they worked, but I tried to write more complex code, following my previous examples, and it indicates that there is a syntax error.
Could you help me identify and understand my mistake, please?
1 2 3 4 5 6 7 8 9 |
My_age = 33 His_age = int ( input ( "Write your age: " )) print ( "My age less yours is: " , My_age - His_age) print ( "My age plus yours is: " , My_age + His_age) Question = int ( input ( "How many years old am I?" ) if My_age = = Question: print ( "Correct" ) else : print ( "Incorrect" ) |