18 lines
607 B
Python
18 lines
607 B
Python
# A simple example of making a function
|
|
|
|
# Functions are blocks of code that can be
|
|
# called/referenced from elsewhere in the code.
|
|
# This can be useful if we need to do some common
|
|
# operation from multiple places. That way we
|
|
# compartmentalize the logic in one place and only
|
|
# have one place that needs edited if the logic must
|
|
# be changed at a later date.
|
|
|
|
def you_baby(name):
|
|
return name + "baby McBabyface"
|
|
|
|
your_name = None
|
|
while your_name != "":
|
|
your_name = input("What is your first name (hit <Enter> to quit): ")
|
|
if your_name != "":
|
|
print("Your name is", you_baby(your_name)) |