+ 1
How can I write a same string in python many times in different lines
7 Respostas
+ 2
Einen hab ich noch:
"/n".join(["word"]*3)
or \n ? I always forget😉
+ 2
Or list unpacking and sep-argument:
print(*['string']*3, sep='\n')
+ 2
Where a loop there a recursion
def hello(word,n):
if n < 1:return
print(word)
hello(word, n-1)
hello("world",3)
+ 1
in a for loop or by using a newline character
+ 1
A) Use a loop
B) Put a linebreak at the end of the string and then * with the desired number.
0
Using a newline character
0
Thanks lisa