Want to print numbers from 1 to 10 using for loop in python, without any spaces and new line. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Want to print numbers from 1 to 10 using for loop in python, without any spaces and new line.

How do I do that?

3rd May 2018, 6:29 PM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar
2 Answers
+ 1
The print function has a end parameter which by default is "\n" so simply change it to ""... for i in range(1, 11): print(i, end="")
3rd May 2018, 6:41 PM
TurtleShell
TurtleShell - avatar
0
Thanks, both the codes are doing the same job! TurtleShell and Ara
3rd May 2018, 6:51 PM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar