Python function program to print the string 10 times

In this python function program, we will create a function to print the string 10 times.

What is Function?
It is a block of code that executes when it is called.
To create a function use def keyword.

Steps to solve the program
  1. Create a function String.
  2. Use the def keyword to define the function.
  3. Pass a parameter i.e. string to the function.
  4. Take a string as input through the user and use this string as a parameter that has passed to the function.
  5. Print the string 10 times by multiplying it by 10.
  6. Pass the string to the function while calling the function.
				
					def String(str1):
    print(str1*10)
    
string = input("Enter a string: ")

String(string)
				
			

Output :

				
					Enter a string: Python
PythonPythonPythonPythonPythonPythonPythonPythonPythonPython
				
			

Related Articles

add two numbers.

print a table of a given number.

Leave a Comment