ok so.. i'm trying to write a program that creates a dictionary of son:father entries and another dictionary that contains father:son entries. The program must present the user a menu with five options.
text file is this: john:fred, fred:bill, sam:tony, jim:william, william:mark, krager:holdyn, danny:brett, danny:issak, danny:jack, blasaen:zade, david:dieter, adamLseth, seth:enos
Problem Statement:
Write a program that creates a dictionary of son:father entries and another dictionary that contains father:son entries. Your program must present the user a menu with five options. The following is an example only:
Father/Son Finder
0 – Quit
1 – Find a Father
2 – Find a Grandfather
3 – Find a Son
4 – Find a Grandson
Option 0 ends the program.
Option 1 prompts the user for the name of a son. If the dictionary contains the son:father pair, the program displays the father. Otherwise, the program should tell the user it does not know who the father is.
Option 2 prompts the user for the name of a grandson. If the dictionary contains enough information, the program displays the grandfather. Otherwise, the program should tell the user it does not know who the grandfather is.
Option 3 prompts the user for the name of a father. If the dictionary contains the son:father pair, the program displays the son. Otherwise, the program should tell the user it does not know who the son is.
Option 4 prompts the user for the name of a grandfather. If the dictionary contains enough information, the program displays the grandson. Otherwise, the program should tell the user it does not know who the grandson is.
The program must create the dictionary structure and populate it from data contained in a file provided to you. In addition, the program must continue to ask the user for a menu choice until the user chooses to quit.
I have this thus far. I haven't gotten very far in it...
sons_fathers = {}
fathers_sons = {}
#open filename: names.dat
fo = open("names.dat", "r")
data = fo.read()
print (data)
for line in fo:
here is the flow chart: ![Flow chart][1]
https://jsu.blackboard.com/bbcswebdav/pid-2384378-dt-content-rid-3427920_1/xid-3427920_1
Thanks for the help. I need it lol.