[1,2,3,1,2,3,1,2,3] print in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[1,2,3,1,2,3,1,2,3] print in python

1 to 3 value in print 3 times

2nd Aug 2022, 5:52 AM
Jeel Bhalodiya
Jeel Bhalodiya - avatar
4 Answers
+ 6
Print([1,2,3]*3) Asterik *operator used for rep.
2nd Aug 2022, 6:08 AM
Mihir Lalwani
Mihir Lalwani - avatar
+ 4
Jeel Bhalodiya Attached is 5 options ranging from simple to silly. You could create a competition asking for people to output this in a unique way, which would involve obfuscation, binary, cyphers & all sorts of other fun trickery. https://code.sololearn.com/cR8I55SJDb6u/?ref=app
2nd Aug 2022, 9:49 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
You can print repetitions of a string, list, etc with the * operator. Example: print(myvar * 2)
2nd Aug 2022, 6:08 AM
Brandon
Brandon - avatar
+ 2
Try this : List = [1,2,3] List = List*3
4th Aug 2022, 12:56 AM
O'neal
O'neal  - avatar