# Chapter4.py # Functions page 107 # Define a function before we call the function # [] brackets lists # {} braces soft brackets template variables sets # () round brackets parans tuples # Define a function using the def keyword def fullName(paramfirstName, paramlastName, parammiddleName=None): if parammiddleName: varFullName = paramfirstName + " " + parammiddleName + " " + paramlastName else: #varFullName = paramfirstName + " " + paramlastName # string interpolation "formatting" f"{tv}" varFullName = f"{paramfirstName} {paramlastName}" print(varFullName) def userInputs(): # Ask the user to enter their first name, middle name and last name. inputfirstName = input("Enter your first name: ").title().strip() # Bob inputmiddleName = input("Enter your middle name: ").title().strip() inputlastName = input("Enter your last name: ").title().strip() # Smith return inputfirstName, inputlastName, inputmiddleName # Bob,Smith # Generate a random sequence id using random module # Standard Module page 125 # Standard Modules need to be imported with the import import random # installed with python def generateSeqID(): seqid = random.randint(100001, 999999) # scope function return seqid # return it to the call function # Default or query string parameter function # Default params have to be at the end of the tuple in Python # (firstname, lastname, middlename=None, state="Florida") # Bob Williams Smith # Bob Smith ##### Application that runs at Runtime ##### #### Moved to myApplication.py PMM 07312024 ####