Multiply string

To repeat a texts multiple times, as a developer, I need to use *


A string can be repeated X number of times, by multiplying it with a X.


print( "hello " * 3 )

or with variables:

a = "hello "
print( a*3 )

and the output will be:

hello hello hello

Just remember to write add a space to "helloโ€ธ", otherwise the addition would give "hellohellohello"



Python code

Terminal output

Written by: Bartek / Bartlomiej Rohard Warszawski