Print 'for loop' without add new line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Print 'for loop' without add new line

The default print in python is make a new line. How to print sequence in a same line using for loop?

1st Dec 2016, 6:29 PM
Luqman Raharjo
Luqman Raharjo - avatar
2 Answers
+ 1
print function in Python has more parameters than you think. you can set the 'end' parameter, which is '\n' by default, to '' (these are two single quotes). there will be no new line after this print. print ('abc', end='') print ('def')
1st Dec 2016, 7:04 PM
Demeth
Demeth - avatar
0
Thanks buddy, it's works
1st Dec 2016, 10:13 PM
Luqman Raharjo
Luqman Raharjo - avatar