What would be the output of the following code snippets? print 4+9 print “4 +9”

 

Answer:

[Python] What would be the output of the following code snippets? - Short Answer Type Questions (2 Marks each)

Output:

13

4 +9

Explanation:

  • In the first print statement, 4 and 9 are considered as integers and ‘+’ is an operator that adds 4 and 9 and then prints the output 13.
  • In the second print statement “4+9” is considered a string since they are enclosed in quotes.
Remove Ads Share on WhatsApp
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo