Aug-23-2019, 04:59 PM
This would do it nicer, but as already mentioned you should rename the main() function e.g. into get_guests() or so.
guest_list, user_name = main()
def get_guests(): """ Initializes the two primary variables and returns them for future use """ guest_list = ["Justin Trudeau", "Joseph Stalin", "Caesar", "Nero",] user_name = input("What is your name? Please spell it in full! >> \n") return guest_list, user_name def check(guest_list, user_name): """ Verifies the user name input and determines if in guest list """ print(guest_list, user_name) if user_name in guest_list: print(f"Welcome, {user_name}!") if user_name not in guest_list: print(f"Hi {user_name}, but unfortunately you are not in the guest list.") include_proposition = input("Would you like to join us anyways? Please enter a Yes or a No >> \n") # THE NEXT LINE DOES NOT WORK! DO IT AS 3 LINES ABOVE! if include_proposition == ("Yes", "Y", "y"): # ------------------------------------------ guest_list.append(user_name) print(f"Thanks, {user_name}! You've been added. Please enter.") # THE NEXT LINE DOES NOT WORK! SEE ABOVE! if include_proposition == ("No", "N", "n"): # ----------------------------------------- print("OK! Have a good night then, my friend!") else: print("Sorry, I didn't get that. Please enter your selection again") def main(): guest_list, user_name = get_guests() check(guest_list, user_name) if __name__ == "__main__": main()