EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
Python代写
您的位置: 主页 > 编程案例 > Python代写 >
代写Python:program代写 ​Computer Project Python program to ana - Python代写
发布时间:2021-07-25 15:13:35浏览次数:
This assignment focuses on the design, implementation and testing of a Python program to analyze some real data using strings, files, and functions.It is worth 75 points (7.5% of course grade) and must be completed no later than 11:59 PM on Tuesday, June 5.Assignment DeliverableThe deliverable for this assignment is the following file:proj03.py – your source code programBe sure to use the specified file name and to submit it for grading via the Mirmir system before the project deadline.Assignment BackgroundWe collected national GDP (Gross Domestic Project) data from the Bureau of Economic Analysis (part of the U.S. Department of Commerce) for the years 1969 through 2015.  The GDP is one of the primary indicators used to gauge the health of a country s economy. It represents the total dollar value of all goods and services produced over a specific time period; you can think of it as the size of the economy. When the economy is healthy GDP is increasing, but if GDP is decreasing, that can indicate problems. Therefore, the change in GDP is useful to examine and that is the goal of this project.We put the data in a file named GDP.txt that is available in the project directory. The file contains data on the annual change in GDP which may be positive or negative and the GDP value itself for each of the years 1969 through 2015.If you are interested in where we got our data, here is the link: http://www.bea.gov/iTable/iTable.cfm?ReqID=9 step=1#reqid=9 step=1 isuri=1(One note about the data. GDP data gets adjusted in a variety of ways. I have extracted two tables from a few thousand lines of tables in the original file. If you try to derive the annual change in GDP from the data on line 44, it will differ by as many as a few percentage points from the change data we are using from line 9. That is, some adjustments are being done that we are ignoring for this assignment.)Assignment SpecificationsThe lines of interest in the file GDP.txt are the 9th line which has the annual change in GDP and the 44th line which has the value of GDP for each year. The data starts in column 76 and each of the 47 data items spans 12 columns (there are 47 years inclusively from 1969 through 2015). These numbersare important because you can use string slicing to extract them. For example, the first data item in aline can be extracted using the slice line[76:76+12].Your task is to find the minimum and maximum change in GDP for the years 1969 through 2015 and to find the GDP value for those two years. See the sample output below. Your program will prompt for an input file and then display the output.You must use specific functions as described below and you are not allowed to use collections such as lists, tuples and dictionaries.Mirmir tests: I can provide any file with the same format as the provided GDP.txt—the number of rows will be the same (so you can select lines 9 and 44), but the number of columns may be different (i.e. different years).Assignment NotesDivide-and-conquer is an important problem solving technique. In fact, inside of every challenging problem is a simpler problem trying to get out. Your challenge is to find those simpler problems and divide the problem into smaller pieces that you can conquer. Functions can assist in this approach.We provide skeleton code on Mirmir that has all the function skeletons for you to fill in.Hint: build the following functions one at a time and test each one before moving on to the next.1. The open_file()function takes no arguments and returns a file pointer. It repeatedly prompts for file names until a file successfully opens. Use the try-except construct checking for the FileNotFoundError exception. You do not need to check that the filename is correct—simply check that the file opened. The simplest version of this function has no error checking so the body of the function is simplyfp = open(“GDP.txt”) return fpHint: Start with that as your function body and add the try-except error checking later.2. The find_min_percent(line) function takes one argument, one line (str) from the GDP.txt file. It returns the minimal value (float) in that line and an index (int) indicating where the minimal value is in the line (you get to decide what value is the index—there are multiple possibilities). You can return two values simply by separating them by commas:return min_value, min_value_indexHere is an algorithm to find a minimal value of a series of values that you read. The algorithm is written in pseudo-code so it looks somewhat like Python, but needs details of Python to be complete:min_value = 10000000 # some large value for each valueif value   min_value: # you have found a smaller value min_value = value # set min_value to that smaller valueHint: Start by having your function simply print all the values in the line. That way you can check that you are examining all the values. Once you can print all the values you can apply the minimum algorithm to find the minimal value.3. The find_max_percent(line) function takes one argument, one line from the GDP.txt file. It returns the maximum value in that line and an index indicating where the maximum value is in the line. This function is nearly identical to the find_min_percent function. Instead of starting with a large value you start with a small value and reverse the operator in the Boolean expression.4. The find_gdp(line,index) function takes two arguments, one line from the GDP.txt file and an index into the line. It returns the GDP value in that line at the specified index. Note that this function can be used to find the GDP value associated with the minimal percent change as well as the maximal percent change—simply call the function with a different index.5. The display(min_val, min_year, min_val_gdp, max_val, max_year, max_val_gdp) function takes six arguments: the minimal value, year and GDP, and the same three for maximum (value, year, GDP). The function does not return anything. It displays the values as shown in the sample below. Note that the GDP values in the file are in billions whereas we expect you to convert billions to trillions for the output.Use the following format string for displaying values: {: 10s}{: 8.1f}{: 6d}{: 18.2f} 6. The main() function loops through the file to access lines 9 and 44, and sets up values for the call to display function.7. You are not allowed to use collections such as list, tuples and dictionaries. Specifically, do not use the string .split() method—it returns a list. Use string slicing to extract values from lines in the file.8. You will be responsible for adhering to items 1-6 of the Coding Standard.Suggested Procedure· Solve the problem using pencil and paper first. You cannot write a program until you have figured out how to solve the problem. This first step can be done collaboratively with another student. However, once the discussion turns to Python specifics and the subsequent writing of Python, you must work on your own.· Use Anaconda to create a new program. Use the required file name (proj03.py).· Write a simple version of the program, e.g. open the file and print all the lines in the file. Run the program and track down any errors. Add one function and retest.· Use the Mirmir system to turn in the first version of your program.· Cycle through the steps to incrementally develop your program:o Edit your program to add new capabilities.o Run the program and fix any errors.· Use the Mirmir system to submit your final version.Sample Output Test 1Enter a file name: xxxx Error. Please try again Enter a file name: GDP.txtGross Domestic Productmin/max change year GDP (trillions) min  -2.8 2009 14.42max 7.3 1984 4.04Grading RubricComputer Project #3 Scoring SummaryGeneral Requirements0  ( 5 pts) Coding standardProgram Implementation00(10 pts) Function (no Mirmir test): open_file (10 pts) Function Test 2: find_min_percent000( 5 pts) Function Test 3: find_max_percent (15 pts) Function Test 4: find_gdp(10 pts) Function (no Mirmir test): display0  (20 pts) Test 1代写CS Finance|建模|代码|系统|报告|考试编程类:C++,JAVA ,数据库,WEB,Linux,Nodejs,JSP,Html,Prolog,Python,Haskell,hadoop算法,系统 机器学习金融类:统计,计量,风险投资,金融工程,R语言,Python语言,Matlab,建立模型,数据分析,数据处理服务类:Lab/Assignment/Project/Course/Qzui/Midterm/Final/Exam/Test帮助代写代考辅导天才写手,代写CS,代写finance,代写statistics,考试助攻E-mail:[email protected]   微信:BadGeniuscs  工作时间:无休息工作日-早上8点到凌晨3点如果您用的手机请先保存二维码到手机里面,识别图中二维码。如果用电脑,直接掏出手机果断扫描。最先出自Essayghost Python代写 python代写服务 北美代写 澳洲代写合作:315代写

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。