Can you repeat strings directly by multiplying them in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you repeat strings directly by multiplying them in python?

Would be awesome with an explanation 👍

1st Sep 2021, 11:08 AM
Tim
Tim - avatar
4 Answers
+ 3
print("str"*3) this will just print strstrstr 3 times its just a syntactic sugar nothing much dont overthink about it 👍🏻 keep on learning u will get used to
1st Sep 2021, 11:10 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 2
Prashanth Kumar What a great explanation, you didn't give me just an explanation but also a brilliant personal opinion, it seriously deserves some great attention to it
1st Sep 2021, 11:20 AM
Tim
Tim - avatar
0
Yes..print("string"*3)
1st Sep 2021, 11:11 AM
Soumaya Islam Rimi
Soumaya Islam Rimi - avatar
0
You can go to playground, create a new Python script and check out what happens when you multiple a string.
1st Sep 2021, 11:31 AM
Lisa
Lisa - avatar