Computers and Technology
Computers and Technology, 08.02.2021 19:30, Dweath50

Assignment Overview This lab exercise provides practice with lists and functions in Python. You will work with a partner on this exercise during your lab session. Two people should work at one computer. Occasionally switch the person who is typing. Talk to each other about what you are doing and why so that both of you understand each step. Programming with Lists and Tuples Develop a Python program that will calculate and display information about exam scores for the students in a class, as described below. The program will read the file scores. txt (no error checking or prompting). Each line of the input file will represent one student and four exam scores, and will have the following format: Name (string, maximum of 20 characters: two words separated by one comma) Name (string, maximum of 20 characters: two words separated by one comma) Exam #x score (integer, range 0 to 100) The student's name will be in the first 20 characters of the line. The four exam scores will be separated by one or more blanks. For example: Hopper, Grace Knuth, Donald Goldberg, Adele Kernighan, Brian Liskov, Barbara 100 98 87 97 82 87 92 81 94 96 90 91 89 74 89 77 87 92 82 85 The program will assume that the input file contains no erroneous data. The program will read the contents of the input file and store the data set in a list of tuples, where each tuple will represent one student and will contain the following information: Name (str) Exam #1 score (int) Exam #2 score (int) Exam #3 score (int) Exam #4 score (int) Exam average (float) The program will assume that the input file contains no erroneous data. The program will read the contents of the input file and store the data set in a list of tuples, where each tuple will represent one student and will contain the following information: Name (str) Exam #1 score (int) Exam #2 score (int) Exam #3 score (int) Exam #4 score (int) Exam average (float) The type of each field within the tuple is listed: the student's name will be type str, the four exam scores will be type int, and the exam average will be type float. After reading and storing the data set, the program will display the following. Each line of student data will use this format string: ":20}{:6d) {:6d) {:6d) {:6d):10.2}" A table representing the data set, sorted alphabetically by name The final row will have the average of each exam with one decimal place. Name Goldberg, Adele Hopper, Grace Kernighan, Brian Knuth, Donald Liskov, Barbara Exam Mean Examl Exam2 Exam3 Exam4 94 96 90 91 100 98 87 97 89 74 89 77 82 87 92 81 87 97 81 85 90.4 90.4 87.8 86.2 Mean 92.75 95.50 82.25 85.50 87.50 * Demonstrate your completed program to your TA. On-line students should submit the completed program (named "lab06.py") for grading via the Mirmir system. Suggestions: Develop the program incrementally: a) Start by reading and displaying each line of the input file to make sure you are reading the data set a) Start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) Use the split string method to extract information from each line into a list. Print the list to prove that this step is working correctly d) Convert the exam scores to type int and calculate the student's average. Display those items to prove this step is working correctly. e) Create a tuple containing the six items for each student (name, exam scores, exam mean). Display the tuples to prove this step is working correctly. (Optionally, you may want to have the exam scores in a list so your tuple is (name, scores list, mean).) Append each tuple to a list. Display the list to prove this step is working correctly. g) Use the sort list method to re-order the tuples in the list. Display the list to prove this step is working correctly h) Use a for statement to display the contents of the list as a table (with appropriate formatting), i) Use a for statement to calculate the average of all scores on Exam #1, then display the results. Note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. 1) Add the logic to calculate the average of all scores on Exam #2, then display the results. Hopper, Grace Knuth, Donald Goldberg, Adele Kernighan, Brian Liskov, Barbara 100 98 87 97 82 87 92 81 94 96 90 91 89 74 89 77 87 97 81 85

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:50, ImBADatmath8743
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
image
Computers and Technology, 22.06.2019 20:30, fickllyd000
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
image
Computers and Technology, 23.06.2019 04:00, china236
In a word processing program, such as microsoft word, which feature to you choose the desired picture enhancement?
Answers: 2
image
Computers and Technology, 23.06.2019 07:50, kmart4062
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
Do you know the correct answer?
Assignment Overview This lab exercise provides practice with lists and functions in Python. You wil...

Questions in other subjects:

Konu
Computers and Technology, 23.04.2021 05:10