Python repeat string
- In python, we can write a given string multiple times without writing any programming language.
- If you have one string and you want to print given string ‘N’ times then what you will do?
- How to repeat a string in python?
In python * Operator used to repeat string ‘N’ times.
Another programming language you use loops or any concatenations but in python, it provides flexibility for a string that is used * Operator (Multiply operator) to print string multiple times.
- The syntax for * operator
String * int_value
The first argument or operand must be string and second must be an integer value.
- Example for * Operator
- That is, In python, you don’t require to write any logic for printing string multiple times, Simply write the number of time you want to print a string.
- This is another feature and flexibility that python provided.