'17'*'87' is that right or wrong??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

'17'*'87' is that right or wrong???

plz explain me why that is wrong??

25th Sep 2017, 10:26 AM
Thanusha dilshan
3 Answers
+ 9
Completely wrong. What would you expect as a result anyway?
25th Sep 2017, 10:39 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 7
You can't multiply strings together so that will give an error, if you multiple a string by an integer though it will print the string 'number' amount of times (e.g. "17" * 87 will print 17, 87 times and 17 * "87" will print 87, 17 times)
25th Sep 2017, 10:42 AM
LynTon
LynTon - avatar
+ 1
Completely wrong, it isn't possible to multiply strings. @LP4 has explained it in detail. There is no need to enclose numbers in inverted commas unless you want them to behave like a string. Try using print(17*87)
25th Sep 2017, 10:56 AM
Harsh
Harsh - avatar