CBSE Class 12 Computer Science Question 28 of 120

Review of Python Basics — Question 2

Back to all questions
2
Question

Question 2

What will be the output of the following code — print("100 + 200") ?

  1. 300
  2. 100200
  3. 100 + 200
  4. 200
Answer

100 + 200

Reason — The output of the code print("100 + 200") will be: 100 + 200. This is because the code is printing the string "100 + 200" as it is written within double quotes. The arithmetic operation inside the string is not evaluated because it's treated as a part of the string literal, not as an actual expression.