The following code is supposed to prompt the user for a number, check to see if the number is equal to 30, and print whether it is or not.
The code contains an error and will not run.
Explain what is wrong.
Assume the user actually enters an integer.
user_input = input("Enter an integer: ")
user_input = int(user_input)
if user_input = 30:
print("The user entered 30.")
else:
print("The user did not enter 30.")
I can not pin point what is wrong exactly, when I run it.
I think something is wrong with the if, else statement part. I have only used Python for 2 weeks now and am still trying to understand it.
=is an assignment;==is a comparison.