Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The variables in the first cell are used in later problems. Do not duplicate the code in later cells or attempt to write similar code.

The variables in the first cell are used in later problems. Do not duplicate the code in later cells or attempt to write similar code.
Use the variable names defined in the instructions for each problem. Failure to do so will result in a loss of points.
You need to use code to arrive at a solution. Hard coding a solution results in 0 points for the problem.
Use only syntax covered in the Units so far. Using any other syntax results in 0 points for the problem.
Some problems below require text and csv files. Files used in these problems must be co-resident with your notebook, otherwise a "file not found" error is thrown. This means that your notebook file (.ipynb) and the text or csv file are visible in your home page.
Run the cell below first
Before starting the assignment, run the cell below. By running this cell, the variables and functions in that cell are loaded into the address space of your notebook, which makes them available to use in your code.
umSchools ={
"A. Alfred Taubman College of Architecture & Urban Planning": 1906,
"College of Engineering": 1854,
"College of Literature, Science, and the Arts": 1841,
"Gerald R. Ford School of Public Policy": 1914,
"Horace H. Rackham School of Graduate Studies": 1912,
"Penny W. Stamps School of Art & Design": 1974,
"School of Dentistry": 1875,
"School of Education": 1921,
"School of Information": 1996,
"School of Kinesiology": 1984,
"School of Law": 1859,
"School of Medicine": 1850,
"School of Music, Theatre & Dance": 1880,
"School of Natural Resources & Environment": 1927,
"School of Nursing": 1893,
"School of Pharmacy": 1876,
"School of Public Health": 1941,
"School of Social Work": 1951,
"Stephen M. Ross School of Business": 1924
}
janTemps ="""2016,6,51
2015,-3,41
2014,-14,43
2013,-3,60
2012,2,55
2011,1,52
2010,3,47
2009,-10,39
2008,3,62
2007,5,50
2006,18,53
2005,-3,56
2004,-6,55
2003,-5,47
2002,11,55
2001,1,43
2000,-2,56"""
Problem 1
The dictionary courses is a hypothetical schedule for a semester. The key is the course code and the value is the number of credits. Print the course code along with the number of credits as shown in expected out. Also, use an accumulation pattern to find the total number of credits taken this semester and assign it to the variable credits. Print the variable credits as shown below.
Do the following:
Iterate over courses:
Print the course code and credits.
Accumulate the credits in the variable credits.
Print the total credits
courses ={'CPS141':4, 'ENG101':3, 'CIS100':3,'CNT206':4,'MTH160':4}
# write your code below
Expected Output:
CPS1414
ENG1013
CIS1003
CNT2064
MTH1604
Total credits this semester 18
Problem 2
The dictionary umSchools maps the names of schools at Michigan to the year they were founded. Write code that creates a dictionary called oldSchools that has the key/value pairs from umSchools that correspond to the schools listed in the list schools.
Do the following:
Iterate over schools:
Create a new dictionary using the current school as the key and the corresponding value from umSchools
Print oldSchools
schools =[ "College of Engineering","School of Nursing","School of Dentistry"]
# write your code below
Expected Output:
{'College of Engineering': 1854, 'School of Nursing': 1893, 'School of Dentistry': 1875}
Problem 3
Using the umSchools dictionary defined in the first cell, write code to add the name of every school that was founded in the 20th century (after 1900) into a list newerSchools. Print the list newerSchools as shown below.
The required output is shown below but only the first three schools are shown to conserve space. There are a total of 11 schools that meet this criterion. The output list must show all 11 schools
Expected Output:
A. Alfred Taubman College of Architecture & Urban Planning was founded in the 20th century.
Gerald R. Ford School of Public Policy was founded in the 20th century.
Horace H. Rackham School of Graduate Studies was founded in the 20th century
Problem 4
Given the string paragraph below, write code to determine the most common word in the string and assign it to the variable commonWord, assign the frequency to maxWordCount. The is a case insensitive frequency which means that case must be disregarded.
There are two parts:
The first part requires a loop that builds a dictionary of words and their frequency.
The second part requires a max accumulation pattern to find the word with the largest count.
A) Do the following to build the frequency dictionary:
Split the paragraph into words and store in a variable.
Initialize an empty dictionary
Iterate over the variable:
You need to remove punctuation from the word.
If the last

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions