I'm a complete rookie programmer and am making a basic 'membership' program to give me some experience with functions and lists So far i have this:
#Club membership program with functions Club = ['George','Isaiah','Alby','Jack'] #FUNCTIONS========================================================================================================================================================================================================= def remove_member(): """Function to delete member from the club""" print('The club members are:', Club) removal_member = str(input('Enter the name of the member you would like to remove:')) if removal_member in Club: Club.remove(removal_member) else: print('Member not found') print('The club members are now:', Club) def add_member(): """Funtion to add a member to the club""" new_member = str(input('Enter the name of the member you would like to add:')) Club.append(new_member) print('The club members are now:', Club) def functions(): print(''' List of current funtions: 1 = Remove a member 2 = Add a member 3 = trherjuthyjht\n''') #MAIN================================================================================================================================================================================================================== print('HELLO AND WELCOME TO THE CLUB MEMBERS PROGRAM') print('The current members of the club are:', Club) functions() run_program = input('Would you like to carry out a function? (y/n):') while run_program == 'y': function_no = int(input('enter the the number of the funtion you would like to execute:')) if function_no == 1: remove_member() run_program = input('Would you like to carry out a function? (y/n):') functions() else: if function_no == 2: add_member() run_program = input('Would you like to carry out a function? (y/n):') functions() input('Thanks you for using the Club membership program, press enter to exit.') what i want to do next is expand my file handling skills: i want to be able to write the list to a file so everytime i open or close the program the list can be retrieved
- how can i do this
- what file type will i need to save it as for python to recognise it as a list
any further help will be much appreciated