22 lines
871 B
Python
22 lines
871 B
Python
# A simple example of making a function
|
|
|
|
from colorama import just_fix_windows_console
|
|
from Utils.TextColors import TextColors
|
|
just_fix_windows_console()
|
|
|
|
# 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(TextColors.BRIGHT_BLUE + "What is your first name (" + TextColors.DARK_GRAY + "hit <Enter> to quit" + TextColors.BRIGHT_BLUE + "): " + TextColors.RESET)
|
|
if your_name != "":
|
|
print(TextColors.BRIGHT_YELLOW + "Your name is " + you_baby(your_name) + TextColors.RESET) |