
python - Display (print) string multiple times (repeatedly) - Stack ...
I want to print a character or string like '-' n number of times. Can I do it without using a loop?.. Is there a function like print ('-',3) ..which would mean printing the - 3 times, like this: ---
python - How to print a string multiple times? - Stack Overflow
Oct 22, 2020 · If you want to print something = '@' 2 times in a line, you can write this: print(something * 2) If you want to print 4 lines of something, you can use a for loop: for i in …
python - How can I print multiple things (fixed text and/or …
There are many ways to do this. To fix your current code using % -formatting, you need to pass in a tuple: A tuple with a single element looks like ('this',). Here are some other common ways of …
How to repeat a String N times in Python | bobbyhadz
Apr 9, 2024 · To print a string multiple times, use the multiplication operator to repeat the string N times.
How To Repeat A String Multiple Times In Python?
Jan 29, 2025 · Learn how to repeat a string multiple times in Python using the `*` operator, join (), and loops. Includes practical examples for efficient string manipulation!
How to Repeat a String in Python? - GeeksforGeeks
Dec 12, 2024 · Using Multiplication operator (*) is the simplest and most efficient way to repeat a string in Python. It directly repeats the string for a specified number of times.
Tutorial: How to Print a String Multiple Times in Python
In Python, printing a string repeatedly can be done in several methods, such as with a loop, the “*” operator, or the “join” method. Programmers should select the appropriate method based on …
How to Repeat a String Multiple Times in Python - Finxter
Jul 29, 2022 · Method 1: Use print () and multiplication operator This method uses Python’s built-in print() statement combined with a multiplication operator to output a string multiple times.
Top 2 Ways to Print a String Multiple Times in Python
Nov 23, 2024 · Have you ever wondered how to print a character or string, such as '-', a specified number of times in Python without resorting to loops? This can be useful for formatting output …
printing a python code multiple times (NO LOOPS0
Oct 4, 2015 · You need to add a newline if you want the output on different lines: It is not possible to get the output as if each string were the output of a new command. The closest to your …
- Some results have been removed