Question: Write a program that creates a dictionary of son-father pairsyou can use celebrities, fictional characters, or even historical figures for fun. Your program should present

  1. Write a program that creates a dictionary of son-father pairsyou can use celebrities, fictional characters, or even historical figures for fun. Your program should present the user a menu with three options. The following is an example:

Father Finder

0 - Quit

1 - Find a Father

2 - Find a Grandfather

3 - List all the sons/keys

  • Option 0 should end the program.
  • Option 1 should prompt the user for the name of a son. If the dictionary contains the son-father pair, the program should display the father. Otherwise, the program should tell the user it doesnt know who the father is.
  • Option 2 should prompt the user for the name of a grandson. If the dictionary contains enough information, the program should display the grandsons grandfather. Otherwise, the program should tell the user it doesn't know who the grandfather is.
  • Option 3 should provide all the names of the sons/keys.
  • The user should be informed if one of the three are true, the son does not exist or the father does not exist or the grandfather does not exist in the dictionary.

The ONE dictionary you create should include several generations so that a grandfather can be found given the name of a grandson. Lets start with

Table 1-Sons&Fathers

John Quincy Adams

John Adams

Bart Simpson

Homer Simpson

Homer Simpson

Grandpa Simpson

John Adams

John Adams Sr.

Put the entries above into a dictionary, and add your own son/father pairs.

Here is a simulation:

 Write a program that creates a dictionary of son-father pairsyou can

python Shell File Edit Shell Debug Options Windows Help Lavers. Channels. Paths. Undo - Brushes. Toolhox Father Finder 0 - Quit 1- Find a Father 2 - Find a Grandfather 3- List Sons Choice:1 Enter the son: Luke Skywalker His father is Darth Vader Father Finder 0 - Quit 1- Find a Father 2 - Find a Grandfather 3- List Sons Choice: 3 dict keys (['Bart Simpson', 'Son of John Quincy Adams', Luke Sywalker', 'John Q uincy Adams', "Homer Simpson']) Father Finder 0 - Quit 1- Find a Father 2 - Find a Grandfather 3- List Sons Choice: 2 nterthe grandson: Bart Simpson Hls grandfather 13 Abraham Simpson Father Finder 0 - Quit 1- Find a Father 2 - Find a Grandfather 3- List Sons Choice: 0 So long Press the enter key to exit. Ln: 51 Col: 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!