0
Why "12"*2 Gives output 1212 ? Why not 24?
😵
3 odpowiedzi
+ 2
"12" is a string, and when multiplying a string, it is repeated as many times as the multiplier is.
Example:
print ("a" * 3)
Output: aaa.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2427/
+ 1
The speech marks("") turn 12 into a string. So 12 * 2 is 24, but "12" is a string so it doubles the string, which is 1212. E.g:
Print("12"*2) == 1212
Print(12*2) == 24
0
Oki Thank You 🌹