The following program was created in Python. Why does the program result in an error?

IT Questions BankCategory: CCNPThe following program was created in Python. Why does the program result in an error?

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.

Exam with this question: CCNPv8 ENCOR (Version 8.0) – Virtualization, Automation, and Programmability Exam

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x