Open In App

Python-Quizzes | Python String Quiz | Question 16

Like Article
Like
Save
Share
Report

Question 16: What is the output of the following program?




a = "GeeksforGeeks "
  
b = 13
  
print (a + b) 


(A) GeeksforGeeks13
(B) 13GeeksforGeeks
(C) GeeksforGeeks
(D) Error


Answer: (D)

Explanation: As you can see the variable ‘b’ is of type integer and the variable ‘a’ is of type string. Also as Python is a strongly typed language we cannot simply concatenate an integer with a string. We have to first convert the integer variable to the type string to concatenate it with a string variable. So, trying to concatenate an integer variable to a string variable, an exception of type “TypeError” is occurred.

Quiz of this Question


Last Updated : 18 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads