Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In python (using anaconda software if possible) 1.Create a Who\'s Your Daddy? pr

ID: 3702711 • Letter: I

Question

In python (using anaconda software if possible)
1.Create a Who's Your Daddy? program that lets the user enter the name of a male and produces the name of his father. (You can use celebrities, fictional characters, or even historical figures for fun.) Allow the user to add, replace, and delete son-father pairs. 


2.Improve the Who's Your Daddy program by adding  a choice that lets the user enter a name and get back a grandfather. Your program should still only use one dictionary of son-father pairs. Make sure to include several generations in your dictionary so that a match can be found.


Explanation / Answer

import pickle

choice = No

sf = {"June Anthony ": "Mark ANthony", "Rohit Mittal": "Mukesh Mittal", "John Hawks": "George Hawks"}

while choice != "0":

print("""

Who's Your Daddy?

=================

Select an option below to find out all about

who someone's daddy is!

0 - Quit

1 - Find out who's your daddy

2 - Add a daddy

4 - Replace a daddy

5 - Delete a daddy

Note: To restore default daddys (if you accidently delete them) just restart the program.

""")

choice = input("Choice: ")

print()

# exit

if choice == "0":

print("Good-bye.")

# find out whos your daddy

elif choice == "1":

print(" Here are all of your people you can currently find out who their daddy is: ")

for key in sf:

print(key)

whoRU = input(" Whats your name ? ")

whoRUCap = whoRU.title()

if whoRUCap in sf:

print(" Who's your daddy ", whoRUCap, "? ", wydd[whoRUCap], sep='')

else:

print(" I dont know who your daddy is :( You can add him from the main menu!")

# add a daddy

elif choice == "2":

addDad = input("What's name of the daddy? ")

addDadCap = addDad.title()

print("What is the name of ", addDadCap, "'s son? ", sep='')

addSon = input(">")

addSonCap = addSon.title()

sf.update({addSonCap: addDadCap})

print(" You added ", addDadCap, " as the daddy of ", addSonCap, "!", sep='')

# list daddys

elif choice == "3":

if sf:

for key in sf:

print("Who's your daddy", key, "?")

print(" ", sf.get(key), " ")

else:

print(" You have no daddys! Try creating some!")

# replace a daddy

elif choice == "4":

print(" Here are all of the sons you can currently replace daddys for: ")

if sf:

for key in sf:

print(" ", key, " ")

dadRep = input("Which son would you like the daddy to be replaced for? ")

dadRepCap = dadRep.title()

if dadRepCap in sf:

print(" Currently ", dadRepCap, "'s daddy is ", sf[dadRepCap], "!", sep='')

newDad = input("What daddy would you like to replace them with? ")

newDadCap = newDad.title()

sf[dadRepCap] = newDadCap

print(" ", dadRepCap, "'s new daddy is now ", newDadCap, "!", sep='')

else:

print(" That daddy doesnt exsist! Try adding him!")

else:

print(" You have no daddys! Try adding some!")

# delete a daddy

elif choice == "5":

dadDel = input("Which daddy would you like to delete?: ")

dadDelCap = dadDel.title()

if dadDelCap in sf:

areusure = input(" Are you sure you want to delete this daddy? 'Y' for YES, 'N' for NO: ")

areusureCap = areusure.upper()

if areusureCap == "Y":

del sf[dadDelCap]

print(" Daddy WAS deleted!")

else:

print(" Daddy NOT deleted!")

else:

print(" That Daddy doesnt exist! Try adding him.")

# some unknown choice

else:

print(" Sorry, but", choice, "isn't a valid choice.")