Thursday , September 19 2024

What is the output of the following snippet? y = 2 + 3 * 5. print(Y)

Questions BankCategory: Python Essentials 1What is the output of the following snippet? y = 2 + 3 * 5. print(Y)
What is the output of the following snippet?

y = 2 + 3 * 5.
print(Y)
  • the snippet will cause an execution error
  • 17
  • 25.
  • 17.0

Explanation: Python is case-sensitive, so y and Y are two different variables. Since the program attempts to print to the screen a value associated with a variable that does not exist in the local namespace, Python doesn’t recognize it, and a NameError exception is raised.

More Questions: Python Essentials 1 – Module 2 Test