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
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh is an IIT Kanpur graduate and has been teaching for 16+ years. At Teachoo, he breaks down Maths, Science and Computer Science into simple steps so students understand concepts deeply and score with confidence.

Many students prefer Teachoo Black for a smooth, ad-free learning experience.