” 写作DS2000程序、Python程序设计Spring 2021Homework 6Your code must be organized into functions. We wont tell you what functions to create, but we expecteach function to…● Have ONE JOB,● be generic, and● be short, clear, and concise.For full credit, we expect all Functions to be commented with name/parameters/return type, and for yourmain to be simple and clear.2Problem 1● Filename: qr.py● Data file: positions.csvUse the csv file provided to generate a QR code using matplotlib. (We did something similar in lecture,using plt.plot() to draw squares, row by row, until we eventually had a pixelated image.)Build your QR code using two colors. In our solution, we used magenta and yellow, but any contrastingcolors will do (black/white, pink/green, red/yellow, etc.) Heres how to read the file:● Row i of the file: All the positions where a magenta square would appear in row i of the QR code.All remaining positions in row i would be yellow.For example, if a row of the file contains…0, 1, 3, 6, 7…then that row of the QR code has magenta squares at 0, 1, 3, 6, and 7, and yellow everywhere else.You can assume that there are 37 total squares per row. You should end up with a scannable QR code,which you should definitely scan to see an important result.Problem 2● Filename: quakes.py● Data file: earthquake_data.csvDownload the CSV file linked above. We got it from the United States Geological Survey (USGS)website, which regularly releases information about earthquakes and other geological events. It containsinformation on all the earthquakes that were recorded in 2020 in the U.S.For this problem, use matplotlib to create a bar chart showing the total number of earthquakes in eachmonth of 2020. Colors and other details are up to you. For full credit, your plot must include appropriatetitle, labels, and xticks.Note about the data:The timestamp of each earthquake is in column zero. It looks like this:2020-12-31T22:37:30.850ZOf all that information, were interested Only in the month. Try using the split function, which wealready know and love. Weve mostly Used str.split(), but you can also specify the character tobreak on, such as str.split(-).3Problem 3● Filename: You can build onto Quakes.py, or if you prefer to create a new file please name itmagnitudes.pyThis problem will use the same Earthquake data as you used for Problem 2. Were still interested inplotting month-by-month data for 2020.But now, instead of the raw number of earthquakes per month, were interested in the number of low-,medium-, and high-magnitude earthquakes that happened each month. You can use whatever ranges areappropriate, as long as you dont end up with empty categories. (We tried setting medium to 3.0-4.0, withlow anything smaller and high anything greater.)Use matplotlib to create a bar Chart with three bars per month — one for low-magntiude quakes, one formedium, and one for high. Use Different colors for low/medium/high, and include a legend in your plot.For full credit, your plot must include appropriate title, labels, and xticks.如有需要,请加QQ:99515681 或WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。