0
Print datatype related
How can integer multiply with string in below code a=8 b=4 c=a/b d=str(c) print(2*d) Output is 2.02.0 How is that possible?
3 odpowiedzi
+ 1
That's just how python works, if you multiply a string by a number it will print the string that many times. What were you expecting or trying to have happen?
0
I thought like python doesn't add string and no. Same it won't multiply string and int and give a ERROR
0
"Hi" * 3 = "Hi" + "Hi" + "Hi" = "HiHiHi"