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
- Create a function String.
- Use the def keyword to define the function.
- Pass a parameter i.e. string to the function.
- Take a string as input through the user and use this string as a parameter that has passed to the function.
- Print the string 10 times by multiplying it by 10.
- 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
Python function program to print a table of a given number.
Python function program to find the maximum of three numbers.
Python function program to find the sum of all the numbers in a list.
Python function program to multiply all the numbers in a list.
Python function program to reverse a string.
Python function program to check whether a number is in a given range.