Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In your program, friends.py , we will practice working with sets. Download the file, people.txt from Canvas, and add 5 more people and their interests

In your program,friends.py, we will practice working with sets. Download the file,people.txtfrom Canvas, and add 5 more people and their interests to give us more people to compare. Just modify the text file, no need to code it. Read in the file and create a dictionary with the names as keys and the set of interests as values. Display the possible names to the user and then allow the user to choose two names to compare their interests. Make use of exception handling to ensure the 2 names (keys) they have chosen are in the dictionary you have created. If one of the names they enter is not in the dictionary, allow them to chose again until both names are valid. If the user enters done, end the program. Then give the user the following options for comparing the two people: what they have in common, all interests they dont have in common, what interests are individual to each person, and also to go back/choose new people. Create three functions, one for each type of comparison. Use set methods, or the short cuts, to get the requested information. Print the result of the comparison chosen.

people.txt:

Chelsea, 27, python, R, traveling, yoga, statistics, Chapman, avocado toast, San Clemente Natalie, 27, python, backpacking, rock climbing, traveling, Chapman, Yorba Linda Abby, 22, python, backpacking, baking, jellybeans, running, Chapman, tacos, Seattle Grace, 18 painting, design, baking, soccer, rock climbing, SDSU, candy, Seattle Ella, 19, baking, soccer, volleyball, jellybeans, yoga, UCI, astronomy, pizza, Seattle Josh, 22, baseball, matlab, running, Stanford, astronomy, cactus, engineering, Pleasanton Jordan, 23, python, hiking, astronomy, baseball, rock climbing, UCI, spaghetti, Pleasanton Erik, 42, matlab, tacos, jellybeans, Stanford, Los Angeles

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions