Computer Science  >  Lab Experiment  >  Michigan State University - CSE CSE231lab09b.py (All)

Michigan State University - CSE CSE231lab09b.py

Document Content and Description Below

# Define the function to create a dictionary #and store the values as dictionaries and sets def build_map(continent_file, city_file): Data_map = {} # read the continents.txt file and #create the ... dictionary of continents and countries continent_country_content = continent_file.readlines() continent_country_content = continent_country_content[1:] #Read each line from the continent_file for line in continent_country_content: # Remove the header of the file continent_list = line.strip().split('\t',1) continent = continent_list[0].strip() country = continent_list[1].strip() #check whether continents exist in the dictionary #or not if continent not in Data_map.keys(): Data_map[continent] = {country : set()} elif country not in Data_map[continent].keys(): Data_map[continent][country] =set() # read the cities.txt file and add cities to the countries #included in the dictionary country_city_content = city_file.readlines() country_city_content = country_city_content[1:] for line in country_city_content: # Remove the header of the file country_list = line.strip().split('\t',1) country = country_list[0].strip() [Show More]

Last updated: 3 years ago

Preview 1 out of 3 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of Michigan State University - CSE CSE231lab09b.py document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$5.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

119
0

Document information


Connected school, study & course


About the document


Uploaded On

Mar 29, 2021

Number of pages

3

Written in

All

Seller


Profile illustration for Expert Tutor
Expert Tutor

Member since 4 years

58 Documents Sold

Reviews Received
6
2
0
0
3
Additional information

This document has been written for:

Uploaded

Mar 29, 2021

Downloads

 0

Views

 119

Document Keyword Tags

Recommended For You

Get more on Lab Experiment »

$5.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·