Test Index

Python Revision Tour Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 58 of 102
Marks: +1, -0
Identify the statement from the following which will raise an error :
[CBSE 2024 Set 4]
Solution:  
Concept:
+ joins two strings or adds two numbers, but it cannot join a string with a number.
Explanation:
print("A"*3) gives AAA (string repetition).
print(5*3) gives 15.
print("15" + 3) raises TypeError: can only concatenate str (not "int") to str.
print("15" + "13") gives 1513 (concatenation).
Answer:
Option C (print("15" + 3))
© examsnet.com
Advertisements
Go to Question: