Python if Loop Calculate Grade

 

#!/bin/python3
import math
import os
import random
import re
import sys
defcalculateGrade(students_marks):
average=0
grade=' '
list=[]
for i in range(len(student_marks)):
sum=0
list=student_marks[i]
for i in range(len(student_marks)):
sum=sum+list[i]
average=sum/len(list):
print(average)
if(average<50):
grade='F'
elif(average>=50)and (average<60):
grade='D'