Question

In: Computer Science

Write a program that uses Python List of strings to hold the five student names, a...

Write a program that uses Python List of strings to hold the five student names, a Python List of five characters to hold the five students’ letter grades, and a Python List of four floats to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input Validation: Do not accept test scores less than 0 or greater than 100.

Solutions

Expert Solution

names=[]
grades=[]
marks=[]
for i in range(5):
f=0
names.append(input("Enter students name:"))#read name of student
temp=[]
while True:
print("Enter test scores:")
temp=[]
for j in range(4):#read 4 scorees
temp.append(int(input()))
if temp[-1]<0 or temp[-1]>100:#check if score is valid or not
print("Enter valid scores")
f=1
break
if f==1:
f=0
continue
else:
marks.append(temp)
break
  
a=(sum(marks[-1])/len(marks[-1]))#get average of scores
print("Average test score is :",a)
if a>90:
grades.append("A")#based on average append grade to list
elif a>80:
grades.append("B")
elif a>70:
grades.append("C")
elif a>60:
grades.append("D")
elif a>50:
grades.append("E")
else:
grades.append("F")
for i in range(5):
print(names[i]," ",marks[i]," ",grades[i])#print names,marks list,grade

Screenshots:

The screenshots are attached below for reference.

Please follow them for output and proper indentation.



Related Solutions

Using LIST and FUNCTION Write a program in Python that asks for the names of three...
Using LIST and FUNCTION Write a program in Python that asks for the names of three runners and the time it took each of them to finish a race. The program should display who came in first, second, and third place.
Write a program in python to read from a file the names and grades of a...
Write a program in python to read from a file the names and grades of a class of students to calculate the class average, the maximum, and the minimum grades. The program should then write the names and grades on a new file identifying the students who passed and the students who failed. The program should consist of the following functions: a) Develop a getGrades() function that reads data from a file and stores it and returns it as a...
Python 8.17 LAB: Strings of a Frequency Write a program that reads whitespace delimited strings (words)...
Python 8.17 LAB: Strings of a Frequency Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, the program outputs the strings from words that have a frequency equal to freq in a case insensitive manner. Your specific task is to write a function wordsOfFreqency(words, freq), which will return a list of strings (in the order in which they appear in the original list) that have a frequency same as the function parameter freq. The parameter...
Write a Python function that takes two parameters: the first a list of strings and the...
Write a Python function that takes two parameters: the first a list of strings and the second a single string. The function should return True or False depending on whether the string is in the list or not. For example, if the list contains eggs, milk, bananas, and the second parameter is pumpkin, the function should return False. Thank you.
Write a Python function that takes two parameters: the first a list of strings and the...
Write a Python function that takes two parameters: the first a list of strings and the second a single string. The function should return True or False depending on whether the string is in the list or not. For example, if the list contains eggs, milk, bananas, and the second parameter is pumpkin, the function should return False. Thank you.
Write a program in C++ that will make changes in the list of strings by modifying...
Write a program in C++ that will make changes in the list of strings by modifying its last element. Your program should have two functions: 1. To change the last element in the list in place. That means, without taking the last element from the list and inserting a new element with the new value. 2. To compare, you need also to write a second function that will change the last element in the list by removing it first, and...
def box_sort(names, sizes): Given a list of strings names, a corresponding list of ints sizes, we...
def box_sort(names, sizes): Given a list of strings names, a corresponding list of ints sizes, we want to sort items by size so that each of our four sublists contains items in the smallest possible boxes of the following exact sizes: 2, 5, 25, and 50 units. Anything larger than 50 won't fit in a box and is simply ignored at this time. Create and return a list of the four sublists of items. o Assume: names is a list...
Declare a Python list named famfri with the first names of five friends or family members....
Declare a Python list named famfri with the first names of five friends or family members. Lists and tuples are examples of what kind of Python construct? Write a Python for loop that prints the names of the friends or family, one per line, without referencing a range or any literal numeric values. Write Python code examples of statements to remove the name at position 2 from the list in the first problem, and to remove one of the remaining...
Write a program in python such that There exists a list of emails List Ls =...
Write a program in python such that There exists a list of emails List Ls = ['xyz@tz.ac.in','sachin.s@gail.com','avinash.paul@hotmail.com','rohan.d@xyz.ac.in',test@zx.ac.in.co'] Count the number of emails IDS which ends in "ac.in" Write proper program with proper function accepting the argument list of emails and function should print the number of email IDs and also the email IDS ending with ac.in output 2 xyz@tz.ac.in rohan.d@xyz.ac.in ================================= i am trying like this but getting confused len [True for x in Ls if x.endswith('.ac.in')] please write complete...
Create an array list (names) that will hold the names of several hall of fame soccer...
Create an array list (names) that will hold the names of several hall of fame soccer players. 2. Place your name on the screen as the master recorder:              “Master Hall of Fame Recorder: John Paul Jones” 3. Ask the user how many names they would like to record. (input 5 when the program runs) 4. Create a loop that will ask for the “Hall of fame member #1: “, etc Add in the following names: Pele Rooney Maradona Messi...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT