Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

parameters in function in python

# Here we define the function with a parameter
def greet(lang):
    if lang == 'spanish':
        print('Hola!')
    elif lang == 'french':
        print('Bonjour!')
    else:
        print('Hello!')

# Now we can call or invoke the function with different parameters
greet('spanish') # Output - Hola!
greet('french') # Output - Bonjour!
greet('english') # Output - Hello!
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #parameters #function #python
ADD COMMENT
Topic
Name
7+6 =