LearnFrenzy
Sign in Take a free test

Python Basics and Syntax · Predict the Output · Question 4

Comments and a stray string Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 4 Back to Exercise

What is the output of the following Python program?

main.py
x = 10  # x = 20
"""x = 30"""
print(x)
  • A 20
  • B 30
  • C SyntaxError
  • D 10 Correct
Correct Answer: Option D

Everything after # is ignored, and the triple-quoted line is just a string expression that is evaluated and thrown away – it assigns nothing.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links