我坚持写这个程序。这些是给我们的指示。
这是我到目前为止所遇到的一些错误:
def menuprint():
print('1. Add/modify student grade.\n')
print('2. Delete student grade\n')
print('3. Print student grades\n')
print('4. Display the course statistics\n')
print('5. Quit\n')
menuprint()
choice = 0
students = []
grades = []
def addmodify():
name_points = input('Enter name and points: ')
nameGrade_list = name_points.split()
name = nameGrade_list[0]
points = nameGrade_list[1]
students.append(name)
grades.append([points])
def stat():
for i in range(0,len(students)):
print("NAME:", students[i])
print ("GRADES:", grades [i])
def mean(list):
sum = 0
floatNums = [float(x) for x in list]
return sum(floatNums) / len(list)
while choice !=5:
choice = int(input('Your choice: '))
if choice == 1:
addmodify()
print('Enter name and points:')
elif choice == 2:
name = input('Enter name to delete:')
students.remove(name)
elif choice == 3:
gradelist()
print ('SS')
elif choice == 4:
print('Mean', mean(grades))