Can anybody please tell me what is wrong with this code.Whenever I try to run this I end up with an invalid syntax error.I'm a beginner, I'd be grateful if you can guide meThank you in advance!
average = 0 highest_num = 0 lowest_num = 0 total_students_mark = 0 for total_studenrts_mark in range (0,19): student_mark = int(input("Enter the student's mark : ")) if student_mark > 14 and < 61: # THE ERROR OCCURS HERE FROM THE GREATER SIGN highest_num = (highest_num + 1) elif student_mark > 61: print ("ERROR !") elif student_mark > 0 and < 6: lowest_num = (lowest_num + 1) else: print ("ERROR !") total_students_mark = (total_students_mark + student_mark) average = (total_students_mark / 20) print ("The average : ", average) print ("The lowest : ", lowest_num) print ("The highest : ", highest_num)
student_mark > 14 and < 61
is nonsense. You wantstudent_mark > 14 and student_mark < 61
, or14 < student_mark < 61
.a > b and < c
. You need to either do (1)a > b and a < c
, or (2) you can combine them withb < a < c
which Python does allow.