In print function '+' is used for cascading likewise '<<' in c++ ...?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In print function '+' is used for cascading likewise '<<' in c++ ...??

my_mark = 55 print("My mark is " + my_mark ) it doesnt work my_mark = 55 print("My mark is " + str(my_mark) ) it works

23rd May 2018, 1:41 PM
I'm_Groot
I'm_Groot - avatar
1 Answer
+ 2
+ is for addition and you cant do calculation between str and int. you could use print("my mark is ", my_mark) to print two different datatypes
23rd May 2018, 1:49 PM
Markus Kaleton
Markus Kaleton - avatar