+ 1

\n separation

Is print("\n") the only and the best way to separate two "programmes" In my code? https://sololearn.com/compiler-playground/c3ooeKRt5ooI/?ref=app

13th Dec 2023, 1:33 PM
Rebecca Harris
Rebecca Harris - avatar
4 Respostas
+ 7
Rebecca Harris as far on sololearn yes an empty print() or using a newline "\n"
13th Dec 2023, 2:54 PM
BroFar
BroFar - avatar
+ 5
print() gives you 1 empty line, and print('\n') gives you 2 empty line. If you want an empty line before print, it can also be done in this way. print('\nHello world')
13th Dec 2023, 2:58 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
Well you can do print("\n" + sorted(cars)). One line makes it look better if that is how you mean "best"
14th Dec 2023, 6:55 PM
Tejas Shyam
Tejas Shyam - avatar
+ 1
if you want a fancy horizontal line, you can use print("\n----------------\n")
15th Dec 2023, 8:52 AM
Bob_Li
Bob_Li - avatar