姓名: 学号:
请注意以下几点:
请将你的程序调试完成后,复制粘贴到对应题目的对话框里面,然后点击末尾的生成作业文件按钮,会自动生成作业文件。请记得填写姓名和学号,生成的文件名会包含你的学号。
请使用这些浏览器来打开作业并生成作业文件:Chrome,Firefox,任何其他的Chrome内核浏览器(如QQ浏览器,360安全浏览器,搜狗浏览器,百度浏览器等等)。Microsoft Edge和Mac笔记本的Safari也支持。请注意:老版IE浏览器不支持。 如果你不能成功生成作业文件,请换一个浏览器尝试。
最后请将生成的作业文件上传到上财教学网的Canvas对应的作业提交。请注意每次作业的截止日期时间,逾期无法提交,迟交的作业扣一半的分数。
如果你想修改你的作业,请不要修改生成的txt文件。请重新填写表单然后重新生成txt文件。不要对生成的txt文件做任何操作(修改内容,修改学号,修改姓名)。
注意!1. 为避免文件下载错误,下载文件格式为压缩zip,请先解压缩数据文件,再运行你的程序。2. 请用相对路径的方式读取和写入数据,将数据和Python模块放在同一目录下,不用提交生成的图片或者文件!3. 第六题请用注释在开头写清楚你用到了哪一列或者几列数据,得到了什么结论,中英文皆可。
Write a program to read the file Harry_Potter.txt and count the number of words in this file. Then, create and write the number of words in another .txt file named 'Count_Words' (You do not have to submit the file you generate.) Download the Harry Potter.txt file.
Given 3 points on a 2D plane, design a function to do the following:
determine whether 3 points lie on a straight line;
if they do not lie on a straight line, draw a triangle with those points. (please import matplotlib) Note that the straight line or one of the triangle's edges may be perpendicular to the x-axis. Please take this possibility into account. The following shows the execution of your program.
81n=[[1,1],[2,2],[3,3]]2threepoints(n)3#output4They lie on a straight line.5----------------------------------------------------------------------------6m=[[1,1],[2,3],[4,2]]7threepoints(m)8#outputThere is a midterm.csv file about the grading results of a course's midterm exam. The first row presents the header. Then, each row presents a student's enrolled name and his or her score. Write a program to read the file and collect all the scores in a list (without the header row!) Download the midterm.csv file. Classify those scores according to the criteria given by question 2 in Problem Set 1. Then, draw a histogram with plotly for ranks A, B, C, D, F.
There is a data set regarding my consumption information in canteens of SUFE in April 2018, Download the data.json file. By Plotly or Matplotlib, please draw a histogram illustrating the frequencies of my visiting different canteens.
With the data in Question 4, draw a line chart to illustrate my daily consumption in April 2018.
The file athlete_events.csv contains 271116 rows and 15 columns. This is a historical dataset on the modern Olympic Games, including all the Games from Athens 1896 to Rio 2016. Each row corresponds to an athlete competing in an Olympic event (athlete events). The columns are explained in the following table:
| ID: Unique number for each athlete | Name: Athlete's name |
|---|---|
| Sex: M or F | Age: Integer |
| Height: in centimeters | Weight: In kilograms |
| Team: Team name | NOC: National Olympic Committee 3-letter code |
| Games: Year and season | Year: integer |
| Season: Summer or Winter | City: Host city |
| Sport: Sport | Event: detailed event |
| Medal: Gold, Silver, Bronze, or NA |
Please pick any column(s) in the data set to draw a figure from which you can draw meaningful conclusions. Download the athlete_events.csv file