1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alja [10]
3 years ago
8

g You need to create a program that will read the scores from the CSV file, pass the scores as a list to the finalGrade function

, and display the resulting final grade, along with the student's name. The input files are attached and the function finalGrade is given. You can assume that the same number of lines will be in the input files. Display the name and final grade for all students in the following format: Bill Gates earned 81.5% Mark Zuckerberg earned 99.6% ...

Computers and Technology
1 answer:
Goshia [24]3 years ago
6 0

Answer:

def finalGrade(scoresList):

""" Function that finds the final grade """

hw1_weighted = float(scoresList[0])/10 * 0.05

hw2_weighted = float(scoresList[1])/10 * 0.05

mid_weighted = float(scoresList[2])/100 * 0.40

fin_weighted = float(scoresList[3])/100 * 0.50

final_grade = (hw1_weighted + hw2_weighted + mid_weighted + fin_weighted) * 100

return final_grade

if __name__ == '__main__':

''' Reading and processing scores '''

# Reading names from text file

names = []

# Opening text file

with open("d:\\Python\\names.txt", "r") as fp:

# Reading data

for line in fp:

# Stripping new line

line = line.strip()

# Adding to list

names.append(line)

# Reading scores

finalGrades = []

# Reading scores

with open("d:\\Python\\scores.csv", "r") as fp:

# Reading data

for line in fp:

# Stripping new line

line = line.strip()

# Scores list

scores = []

# Iterating over scores

for score in line.split(','):

# Adding to list

scores.append(score)

# Finding grade

grade = finalGrade(scores)

# Adding to list

finalGrades.append(grade)

# Printing result

for i in range(len(names)):

print("\n%s earned %.1f%%"%(names[i], finalGrades[i]))

Explanation:

This program was implemented with python programming language.

This program will read the scores from the CSV file, pass the scores as a list to the finalGrade function, and display the resulting final grade, along with the student's name.

See attachment for screenshots

You might be interested in
Which of the following characteristics of an e-mail header should cause suspicion?A. Multiple recipientsB. No subject lineC. Unk
julsineya [31]

Answer:

The correct answer for the given question is option(b) i.e " No subject line"

Explanation:

In the e-mail subject is the important part which describe the information which kind of particular mail is send or received .if we do not give any subject line in the e-mail header then most of the chances that email will not read by recipients due to this suspicion will be caused.

Unknown Sender and Multiple recipients do not cause suspicion so the correct answer is option(b) i.e No subject line".

3 0
3 years ago
write a recursive bool valued function containsvowel that accepts a string and returns true if the string contains a vowel
zhannawk [14.2K]

Answer:

Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A string contains a vowel if: The first character of the string is a v…

Explanation:

A:

bool containsVowel (string s) { bool hasVowel=false; if (s.length()==0) return false; else if (s[0]=='a'|| s[0]=='e'|| s[0]=='u'|| s[0]=='o'|| s[0]=='i'|| s[0]=='A'|| s[0]=='E'|| s[0]=='U'|| s[0]=='O'|| s[0]=='

7 0
3 years ago
What is required for sitting with your seatbelt on while driving?
Alexxandr [17]
It should be D I believe
5 0
3 years ago
A computer professional who has access to sensitive information shares this information with a third party. Which professional c
Airida [17]

The correct answer is c

6 0
3 years ago
Read 2 more answers
Knowledge of HTML and CSS is considered essential for the job of a(n)
Ira Lisetskai [31]
I'm not sure but I think d. Webmaster
8 0
3 years ago
Other questions:
  • Write a program that estimates the approximate number of times the user’s heart has beat in his/her lifetime using an average he
    12·1 answer
  • ________ viruses are often transmitted by a flash drive left in a usb port.
    8·1 answer
  • When you buy an Xbox 360 can you play online for free
    12·2 answers
  • Which files have not been processed by your camera or computer?
    13·1 answer
  • What is the most likely result of a correctly installed processor, but an incorrectly installed cooler?
    6·1 answer
  • #Write a function called alter_list. alter_list should have#two parameters: a list of strings and a list of integers.##The list
    11·1 answer
  • Which among the following if absent, a computer is not complete.
    6·2 answers
  • Boolean, integer, string, and float are examples of:
    9·2 answers
  • Write a program that reads and unspecified number of integers, determines how many positive and negative values have been read,
    10·1 answer
  • The electors in each state shall have the qualifications requisite for electors of the most numerous branch of the state legisla
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!