The corrected code is shown below
python
# Program will be tested with values: 1, 2, 3, 0.
user_num = int(input()) # convert input to integer
if user_num == 2:
print("Num is equal to two")
else:
print('Num is not two')
The errors in the main code was that; The user_num variable was not being converted to an integer before being compared to 2. This caused the code to print "Num is equal to two" for all input values, because the comparison user_num == 2 is always true when user_num is a string.
Also, The closing parenthesis for the print() statement in the else block was missing. This caused a syntax error.
See text below
1f-else statement: Fix errors. Start Find and fix the error in the if-else statement
1 usernum - Int(input) # Program will be tested with values: 1, 2, 3, 0.
2
3 if user_num= 2:
4 print("Num is equal to two
5 else: print('Num is not two)
6
7
8