The following program includes 10 cities that two people have visited. Write a program that creates: 1. A set all cities that contains all of the cities both people have visited. 2. A set same_cities that contains only cities found in both person1_cities and person2_cities. 3. A set different_cities that contains cities found only in person1_cities or only in person2_cities. Sample output for all cities: ['Accra', 'Anaheim', 'Bangkok', 'Bend', 'Boise', 'Buenos Aires', 'Cairo', 'Edmonton', 'Lima', 'London', 'Memphis', 'Orlando', 'Paris', 'Seoul', 'Tokyo', 'Vancouver', 'Zurich'] NOTE: Because sets are unordered, they are printed using the sorted() function here for comparison. 427862.2461524.qx3zqy7 1 person1_cities = {'Edmonton', 'Vancouver', 'Paris', 'Bangkok', 'Bend', 'Boise', 'Memphis', 'Zurich', 'Accra', 'C 2 person2_cities = {'Accra', 'Orlando', 'Tokyo', 'Paris', 'Anaheim', 'Buenos Aires', 'London', 'Lima', 'Seoul', 'B 3 4# Use set methods to create sets all cities, same_cities, and different_cities. 5 7 print (sorted (all_cities)) 8 print (sorted (same_cities)) 9 print (sorted (different_cities))
The following program includes 10 cities that two people have visited. Write a program that creates: 1. A set all cities that contains all of the cities both people have visited. 2. A set same_cities that contains only cities found in both person1_cities and person2_cities. 3. A set different_cities that contains cities found only in person1_cities or only in person2_cities. Sample output for all cities: ['Accra', 'Anaheim', 'Bangkok', 'Bend', 'Boise', 'Buenos Aires', 'Cairo', 'Edmonton', 'Lima', 'London', 'Memphis', 'Orlando', 'Paris', 'Seoul', 'Tokyo', 'Vancouver', 'Zurich'] NOTE: Because sets are unordered, they are printed using the sorted() function here for comparison. 427862.2461524.qx3zqy7 1 person1_cities = {'Edmonton', 'Vancouver', 'Paris', 'Bangkok', 'Bend', 'Boise', 'Memphis', 'Zurich', 'Accra', 'C 2 person2_cities = {'Accra', 'Orlando', 'Tokyo', 'Paris', 'Anaheim', 'Buenos Aires', 'London', 'Lima', 'Seoul', 'B 3 4# Use set methods to create sets all cities, same_cities, and different_cities. 5 7 print (sorted (all_cities)) 8 print (sorted (same_cities)) 9 print (sorted (different_cities))
Chapter5: Looping
Section: Chapter Questions
Problem 13E
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,