# MyApplication.py ## myFunctions.py # Python Standard Module Imports import datetime # Custom Modules import myFunctions from myMenuFunctions import viewContacts, viewContact, newContact, updateContact, deleteContact # Do NOT put the (tuple) on the obj name ''' 3 ways to import a Standard Module or Custom Module import ModuleName -> access to ALL objects in the Module thru the ModuleName -> ex. myFunctions.myHeader() from ModuleName import ObjectName -> access to SPECIFIC objects in a Module -> myHeader() import ModuleName as Namespace/Alias -> access to ALL objects thru a specific namespace/alias -> import myFunctions as myf -> myf.myHeader() ''' def main(): # variables and globals would live here OR be passed to the main() contacts = [] # As functional as possible myFunctions.myHeader() # myMainMenu called from myHeader() # Ask the user what they want to do? # int input >0 <6 1,2,3,4,5 selectedOption = int( input("What option do you want to perform? ")) if selectedOption > 0 and selectedOption < 6: if selectedOption == 1: # call the newContact() newContact(contacts) elif selectedOption == 2: # call the updateContact() updateContact() elif selectedOption == 3: # call the viewContact() viewContact() elif selectedOption == 4: # call the deleteContact() deleteContact() elif selectedOption == 5: # call the viewContacts() viewContacts() else: print() else: print("Invalid menu selection") # Based on the int input -> call the appropriate function to do the action # 1 -> newContact() # 2 -> updateContact() # 3 -> viewContact() # 4 -> deleteContact() # 5 -> viewAllContacts() or Show the contacts at the top ''' # Ask the user for the contact information # return firstName, lastName # tuple(immutable) fName, lName = myFunctions.userInputs() # calling userinputs() # fName, lName = (firstName, lastName) # fName, lName = ('Bob','Smith') # unpack the values from the tuple print(fName) # 'Bob' print(lName) # 'Smith' # Call the fullName function and pass the 2 variables from the scope # fName and lName are in the scope of main() # we need to PASS them to fullName() completeName = myFunctions.fullName(fName, lName) print(completeName) ''' if __name__ == '__main__': main()