The following program was created in Python.
user_input = int( input(" What is 3 * 2? "))
if (user_input = 6):
print (" Correct!")
else: print (" Incorrect...")Why does the program result in an error?
- There should be double equal signs when checking conditional equality.
- The quotation mark is not needed in the print function.
- 3 * 2 does not equal 6.
- The user_input variable was not defined.
Explanation: A single equal sign is used to assign a variable. This program should use double equal signs to check equality.
Related exam: CCNP Core Networking: Modules 27 - 29 Checkpoint Exam: Virtualization, Automation, and Programmability Exam
