Function Arguments in Python| EP-44 Types of Function Arguments in Python| Types of Python Arguments
Types of Python Function Arguments
"""Python supports various types of arguments that can be passed at the time of the function call. In Python, we have the following function argument types in Python:
1. Default argument
2. Keyword arguments (named arguments)
3. Positional arguments
4. Arbitrary arguments (variable-length arguments *args and **kwargs)"""
1.Default Arguments
"""A default argument is a parameter that assumes a default value if a value is not provided in the function call for that argument."""
def numbers(x,y=20):
print("x:",x)
print("y:",y)
numbers(10)
2. Keyword Arguments
"""It allow you to specify the name of the argument along with its value, making the code more readable and maintainable."""
def student(firstname, lastname):
print(firstname, lastname)
student(firstname='Cybrosys', lastname='Technologies')
3. Positional Arguments
"""We used the Position argument during the function call so that the first argument (or value) is assigned to name and the second argument (or value) is assigned to age.
By changing the position, or if you forget the order of the positions, the values can be
used in the wrong places."""
def nameAge(name, age):
print("Hi, I am", name)
print("My age is ", age)
nameAge("Suraj", 27)
nameAge(27, "Suraj")
#PythonTutorial #PythonFunctionArguments #LearnPython #FunctionArguments #PythonCoding #CodingForBeginners #PythonProgramming #ProgrammingBasics #PythonDevelopment #TechEducation #Python #PythonTutorial #FunctionArguments #Programming #PythonProgramming #LearnPython #PythonTips #PythonCode #CodingTutorial #Developer #SoftwareDevelopment #ProgrammingLanguages
Connect With Us:
—————————————
➡️ Website: https://www.cybrosys.com/
➡️ Email: info@cybrosys.com
➡️ Twitter: / cybrosys
➡️ LinkedIn: / cybrosys
➡️ Facebook: / cybrosystechnologies
➡️ Instagram: / cybrosystech
➡️ Pinterest: / cybrosys