Computers and Technology
Computers and Technology, 24.03.2021 18:00, giovney

Given two files named exactly "data1.txt" and "data2.txt" (no error checking needed) of names and scores print out the combined scores in alphabetical order by name. Note that the files will be formatted the same, but some names will be in both files and some names will only be in one file. For names in both files the scores need to be summed. The file format will be one header line followed by lines that have a name (string) and a number (int) separated by some unknown number of spaces. For output use this format string "{:10s} {:<10d}" Requirements:
(1) You must use a dictionary.
(2) You must use at least two functions that have a dictionary as an argument, e. g. read a file, print results.
For example, if data1.txt contains
Name Score
Joe 20
Mary 70
Rich 50
Jose 90
and data2.txt contains
Name Score
Sarah 80
Ming 20
Joe 65
Rich 30
The output will be:.
Name Total
Joe 85
Jose 90
Mary 70
Ming 20
Rich 80
Sarah 80
The program should be in Python...

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, alexj29227405
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
image
Computers and Technology, 23.06.2019 15:00, lopez7512
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
image
Computers and Technology, 23.06.2019 15:20, yeahmaneee
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
image
Computers and Technology, 24.06.2019 10:00, noahmace
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
Do you know the correct answer?
Given two files named exactly "data1.txt" and "data2.txt" (no error checking needed) of names and sc...

Questions in other subjects:

Konu
Mathematics, 26.01.2021 14:00