+ 1

How can I write a same string in python many times in different lines

26th Apr 2022, 5:15 PM
Uttam
7 Respuestas
+ 2
Einen hab ich noch: "/n".join(["word"]*3) or \n ? I always forget😉
26th Apr 2022, 7:20 PM
Oma Falk
Oma Falk - avatar
+ 2
Or list unpacking and sep-argument: print(*['string']*3, sep='\n')
26th Apr 2022, 7:30 PM
Lisa
Lisa - avatar
+ 2
Where a loop there a recursion def hello(word,n): if n < 1:return print(word) hello(word, n-1) hello("world",3)
27th Apr 2022, 6:05 AM
Oma Falk
Oma Falk - avatar
+ 1
in a for loop or by using a newline character
26th Apr 2022, 5:20 PM
Slick
Slick - avatar
+ 1
A) Use a loop B) Put a linebreak at the end of the string and then * with the desired number.
26th Apr 2022, 5:21 PM
Lisa
Lisa - avatar
0
Using a newline character
26th Apr 2022, 5:21 PM
Uttam
0
Thanks lisa
26th Apr 2022, 5:22 PM
Uttam