Answered step by step
Verified Expert Solution
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 points for the problem.
Use only syntax covered in the Units so far. Using any other syntax results in points for the problem.
Some problems below require text and csv files. Files used in these problems must be coresident 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":
"College of Engineering":
"College of Literature, Science, and the Arts":
"Gerald R Ford School of Public Policy":
"Horace H Rackham School of Graduate Studies":
"Penny W Stamps School of Art & Design":
"School of Dentistry":
"School of Education":
"School of Information":
"School of Kinesiology":
"School of Law":
"School of Medicine":
"School of Music, Theatre & Dance":
"School of Natural Resources & Environment":
"School of Nursing":
"School of Pharmacy":
"School of Public Health":
"School of Social Work":
"Stephen M Ross School of Business":
janTemps
Problem
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 CPS: 'ENG: 'CIS:CNT:MTH:
# write your code below
Expected Output:
CPS
ENG
CIS
CNT
MTH
Total credits this semester
Problem
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 keyvalue 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': 'School of Nursing': 'School of Dentistry':
Problem
Using the umSchools dictionary defined in the first cell, write code to add the name of every school that was founded in the th century after 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 schools that meet this criterion. The output list must show all schools
Expected Output:
A Alfred Taubman College of Architecture & Urban Planning was founded in the th century.
Gerald R Ford School of Public Policy was founded in the th century.
Horace H Rackham School of Graduate Studies was founded in the th century
Problem
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started