i'am learning python so please don't be too hard if my question seems simple to you.this is not the real program it's just to make it simple and clear for the question. the real program is supposed to create and save a dictionnary to a text file, and different functions to read, delete , add data to this dictionnary. i have to files for a program: 1 all my functions 2 the main prog
#file1
def create_dict():
dico={}
name=input('name')
age=input('age')
coef=input('coeff')
dico[name]=(age,coef)
return dico
def print_dict(dico):
print(dico)
def fin():
exit()
so i'm using a dict to then execute the appropriate function chosen.
#file2 main
from file1 import *
do={'C':create_dict,'P':print_dict,'E':fin} #dict of references to functions
while 1:
rep=input('choice?\n' # ask user to chose what action
'C-reate dict\n'
'P-rint dict\n'
'E-xit\n')
do[rep]() # execute the function chosen
So my questions are: how do i get the return of my first function create_dict? how to give the parameter needed for my function print_dict? thanks for your help