+ 1
How to display the same messages 5,4,8 or more times?
print("Welcome to Python") print("Welcome to Python") print("Welcome to Python") print("Welcome to Python") print("Welcome to Python") As a beginner i code it like this.Is there any other method to code same messages more times? Or message="welcome to python" print(message*5) Can we modify this code to display message in difficult lines?
7 Respuestas
+ 2
You may find answer in https://books.google.com/books/about/Python_Programming.html?id=Z0ilDwAAQBAJ
+ 1
You can use for- or while-loops. Loops are covered in the python course, have a look at it :-)
+ 1
i=0;
num_print=5;
your_text="Your text here!";
while i < num_print:
print(your_text);
i+=1
+ 1
message =" welcome to python"
print((message + '\n') * 5)
very similar to your description example.
+ 1
For different lines you can go for the following code:
print("Welcome to python \n" *5)
+ 1
Oh thanks 😊
0
a = 'do the python course'
for I in range (5):
print (a)
Lisa said it best. Just do the python course, you'd understand more and better about this things.