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. Why does the program result in an error? 1ITExamAnswers Staff asked 1 month ago
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.

More Questions: CCNPv8 ENCOR (Version 8.0) – Virtualization, Automation, and Programmability Exam


Related Articles