Question within the app | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Question within the app

What is the output of the following Print (3* ‘7’) • I did put 21 but am I missing surrounding parentheses? What may be the issue

4th Feb 2022, 3:31 AM
Jaycee Paypompee
3 Answers
+ 3
777 when you multiply by String it repeats the amount of times by the number which you have multiplied
4th Feb 2022, 3:33 AM
L.M.Paredes
L.M.Paredes - avatar
0
Jaycee Paypompee There would be a error as Print is a invalid syntax.🙄 Well but if I take Print as print (suppose), then it will print 777. As said by L.M.Paredes, when you multiply a string with a integer the string gets repeated. Hope you will try this yourself next time. For to get 21, you should multiply the ints (integers or they can be float), like this: print(3.0*7.0) (Gives result as a float: 21.0) OR print(3*7) (Gives result as a int: 21)
4th Feb 2022, 4:25 AM
NEZ
NEZ - avatar
0
I understand now very helpful explaination , thanks
4th Feb 2022, 7:25 AM
Jaycee Paypompee