You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
614 B
Python
17 lines
614 B
Python
# In this example, I use def to define the function named, i_love,
|
|
# the parameter is fruits and the argument is 'Apple'.
|
|
|
|
def i_love(fruit): # first line of FUNCTION DEFINITION
|
|
print(f"I love to eat {fruit}s!") # second line
|
|
|
|
i_love('Apple') # FUNCTION CALL here!
|
|
|
|
|
|
# Function calls have arguments, like 'Apple' here, and function definitions
|
|
# have parameters. The parameter here is fruit. The argument is a *value*,
|
|
# and the parameter is a *name*. Values are mapped to names, just like with
|
|
# an assignment statement. It's the same as:
|
|
#
|
|
# fruit = 'Apple'
|
|
#
|