# Chapter4Main.py # main runtime page 108 ''' 3 methods to import a Module import ModuleName -> The module name is the filename without the extension (.py, .ipynb, ...) from ModuleName import ObjectName -> from Chapter4Modules import customerInfo import ModuleName as Namespace/alias -> import Chapter4Modules as c4m ''' # imports top file -> as long as they are imported before you call them import Chapter4Modules as c4m def main(): print("This would be the main function for our program") # we will still need to call in order # Still going to have structural objects in main first_name = input("Enter your first name: ") last_name = input("Enter your last name: ") newFullNameVar = c4m.customerInfo(first_name, last_name) # new variable = return value from function print(f"Contact Full Name: {newFullNameVar}") # collect the ccInfo from the user ccNum = input("Enter CC Num: ") ccExp = input("Enter CC Exp: ") ccCVC = input("Enter Security Code: ") cartTotal = 5050.25 # print the approve or decline return returnCode, amount = c4m.ccInfo(ccNum,ccExp,ccCVC,cartTotal) # formattedAmount = round(amount,2) # formattedAmountOption2 = "{:.2f}".format(amount) resultA = f"You have been {returnCode} for ${amount:.2f}." resultD = f"You have been {returnCode}. You are over your credit limit by ${amount:.2f}" if returnCode == "Approved": print(resultA) elif returnCode == "Declined": print(resultD) else: # Excecption to our expected returns print("An error occurred while processing your credit card, please try again later.") if __name__ == "__main__": print("Application is initializing...") main() ''' main -> visible object _main -> hidden object, we have to access the obj in a "special way" __name -> objects that are defined as attributes aka meta data objects ''' # EOF Chapter4Main.py