Python Jupyter notebook Assignment

See screenshots at the bottom of the page

Order Description

Question 1. (15 points). The formula that describes the volume V of a sphere with radius r is the following: 𝑉 = 4 /3∗ 𝜋 ∗ 𝑟3 Write a program in the “_assognment-two-code.ipynb” file to calculate the value of V when r is in the range of 1– 10. Output the result in the following format: r V 1 … 2 … 3 … Question 2. (30 points). Python files reading and writing. Download the “Assignment 2 data collection.zip” to your local and un-zip it. Write a program in the “_assognmenttwo-code.ipynb” file to finish the following task: (1) (10 pts) Write a program to read all the txt files and save the sentences in all the files into one csv file with two columns, the first column is sentence id (txt file name+sentence line number), the second column is the sentence text content.

(2) (10 pts) Remove all the numbers, special characters, punctuation from the sentences, save the processed sentences into a new column in the same csv file.

(3) (10 pts) Ask the user to enter a word, return all the sentences that include this word, three kinds of information should be returned: sentence id, sentence text content, the count that user input word appear in the sentence.

Question 3. (20 points). In the field of Data Science, data is often formatted as a commadelimited (CSV) file, where each line in a file corresponds to a field's value. Refer to Chapter 9 (p. 106) for more information on comma-delimited files. To answer this question, you will need to download the file Assignment2_denton_housing.csv included with this assignment. The file Assignment2_denton_housing.csv contains statistics about housing in the city of Denton from 2008 to 2014. Write a program in the “_assognment-two-code.ipynb” file to do the following:

(1) (10 pts) Calculate the difference in the number of Occupied Housing Units from year to year and print it. The difference must be calculated for the consecutive years such as 2008-2009, 2009-2010 etc. Finally, print the values in the ascending order.

(2) (15 pts) For all the years, calculate the percentage of housing units which are vacant an occupied. Print the results in the following format: Year Vacant Housing Units Occupied Housing Units 2008 30% 70% 2009 ----- ----- 2010 ----- ----- 2011 ----- ----- 2012 ----- ----- 2013 ----- ----- 2014 ----- -----

(3) (15 pts) Calculate and print the valued and years in which the highest number of housing units were vacant and occupied. Print the results in the following format: Year Value Vacant Housing Units ----- ----- Occupied Housing Units ----- -----

(4) (15 pts) Calculate the harmonic mean of the total housing units and print it out. You can find the information about harmonic mean here: https://ncalculators.com/statistics/harmonic-mean-calculator.htm