Lab 6: files, ifs, loops, and functions Due date: 7/10/2022 Problem: You have been hired by Channel 5 to help produce st
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Lab 6: files, ifs, loops, and functions Due date: 7/10/2022 Problem: You have been hired by Channel 5 to help produce st
#Prompt the user to "Please enter the name of the file to be processed: " and save it #Open file specified by the user and assign it to a file variable # Create an empty list # Use a for-loop to get each value from the file Append the content of the line read from the file (converted to int) at the end of the list # Call the function to print the data # Close the file # Prompt the user "Do you want to process another month[y/n]?" and save it Note: You must choose the MOST appropriate type of if statement and loop to implement this algorithm. In some cases, you may need to use several Python statements to implement a single step of the algorithm, use your excellent critical thinking and problem-solving skills to come up with the best implementation possible. # This lab requires you to use the tools I taught so far so review your class notes and read the tutorial. Look at the examples used in my lectures. If you have concerns or specific questions, post them on the Discussion Board of Blackboard. To get information about the statistics module click on https://docs.python.org/3/library/statistics.html I am showing a sample run of my solution for your reference. Please run your program and ensure that it works like mine. The input and output formatting must be like the one used in my sample solution. Don't forget to include the following comments at the top of your program. CSCI 1380 First and Last Name First and Last Name of teammate Summer I 2022 Summer 1 2022 Lab # 6 Please name your file lab6TXX (where XX are the two digits corresponding to your team number). Do not include blank spaces in the name of the file please. The following is the Rubrics: When done, upload and submit your program solution through Blackboard using the link corresponding to this assignment. Do Not email it. Include the link to your replit.com solution in the Comments box. 1) Correct implementation of the if statement 2) Correct implementation of the loop
3) Correct implementation of the function 4) Program to implement the algorithm provided 5) Appropriate comments in source code 6) Good formatting of the input 7) Good formatting of the output 8) Python file 9) Link to replit.com solution 10) Correcty file name Sample runs of my program Please enter the name of the month to be processed: September Please enter the name of the file to be processed: sep_temp.txt List of temperatures corresponding to month September Lowest temperature: 74 Highest temperature: 90 The median for the month is: 84.5 Day 1: 87 is greater than median Day 2: 86 is greater than median Day 3: 86 is greater than median Day 4: 84 is less than median Day 5: 82 is less than median Day 6: 83 is less than median Day 7: 80 is less than median Day 8: 74 is less than median Day 9: 83 is less than median Day 10: 80 is less than median Day 11: 79 is less than median Day 12: 81 is less than median Day 13: 84 is less than median Day 14: 88 is greater than median Day 15: 84 is less than median Day 16: 85 is greater than median Day 17: 86 is greater than median Day 18: 90 is greater than median Day 19: 89 is greater than median Day 20: 89 is greater than median Day 21: 90 is greater than median Day 22: 88 is greater than median Day 23: 86 is greater than median Day 24: 86 is greater than median Day 25: 87 is greater than median Day 26: 86 is greater than median Day 27: 84 is less than median Day 28: 80 is less than median Day 29: 82 is less than median Day 30: 82 is less than median SumuvCE
Do you want to process another month[y/n]? y Please enter the name of the month to be processed: October Please enter the name of the file to be processed: oct_temp.txt List of temperatures corresponding to month October Lowest temperature: 13 Highest temperature: 75 The median for the month is: 68 Day 1: 72 is greater than median Day 2: 73 is greater than median Day 3: 74 is greater than median Day 4: 75 is greater an median Day 5: 73 is greater than median Day 6: 70 is greater than median Day 7: 69 is greater than median Day 8: 70 is greater than median Day 9: 72 is greater than median Day 10: 70 is greater than median Day 11: 60 is less than median Day 12: 66 is less than median Day 13: 72 is greater than median Day 14: 73 is greater than median Day 15: 70 is greater than median Day 16: 48 is less than median Day 17: 48 is less than median Day 18: 59 is less than median Day 19: 65 is less than median Day 20: 68 is equal to median Day 21: 71 is greater than median Day 22: 71 is greater than median Day 23: 59 is less than median Day 24: 50 is less than median Day 25: 36 is less than median Day 26: 53 is less than median Day 27: 55 is less than median Day 28: 13 is less than median Day 29: 31 is less than median Day 30: 54 is less than median Day 31: 66 is less than median Do you want to process another month[y/n]? n