I am learning Python, This is my current exercise:
Write a program that stores the subjects of a course (for example:Mathematics, Physics, Chemistry, History and Language) in a list, ask the user for the grade they have taken in each subject and remove from the list approved subjects. At the end the program must show on screen the subjects that the user has to repeat.
I have the following code:
classes = ['math', 'chemistry', 'History', 'Marketing']
gradelist = []
for i in range(len(classes)):
grade = int(input(f"Please provide your grade in {classes[i]}: "))
gradelist.append(grade)
print("These are the classes you need to take again because of failure:")
for i in range(len(classes)):
for y in range(len(gradelist)):
if gradelist[y] > 69:
classes.remove(classes[i])
gradelist.remove(gradelist[y])
print(f"{classes[i]} Grade : {gradelist[y]}")
Can anyone please help me, its not working. I can Enter the grades but I am missing something on removing the passed subjects and grades above 70.