KnowledgeBoat Logo

Computer Science

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

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

Python String Manipulation

1 Like

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.

Answered By

2 Likes


Related Questions