0
I am curious
How can I make this code print (("ni"*3)+("!")) result in a ni ni ni! and ni! ni! ni!
5 Respuestas
+ 4
print(("ni!\n")*3)
+ 2
use a newline character '\n'
print("Tom\nand\nJerry")
#output
Tom
and
Jerry
+ 2
Slick your solution works, but output an unexpected blank line at the end if you doesn't specify end="" as named optional argument to the print statement ^^
Jan Markus solution might be the most 'pythonic' way, as he unpack a list of 3 items and explicitly set sep="\n" as optional separator named argument (instead of default one space string)
0
iTech thanks, I see now, I have to put \n after “ni!”
0
hahaha okay buddy Vladislav Umanets