Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.1 kB
1
Indexable
Never
exam_score = int(input("What is your exam score? "))
homework_average = float(input("What is your homework average? "))
exercise_submitted = int(input("How many exercises have you submitted? "))

if exercise_submitted > 8 or (exam_score < 0 or exam_score > 100) or (homework_average < 0 or homework_average > 100):
    print("Input out of range")
    exit()

if exercise_submitted <= 4:
    final_grade = 0
    
elif exercise_submitted == 5 or exercise_submitted == 6:
    if exam_score >= 55:
        final_grade = 0.8*exam_score + 0.2*homework_average
    else: exam_score <= 54
    final_grade = exam_score
    
else:
    exercise_submitted == 7 or exercise_submitted == 8
    if exam_score <= 54 and homework_average >= 80:
        final_grade = 0.25*homework_average + exam_score
    elif exam_score<= 54 and homework_average < 80:
        final_grade = 0.2*homework_average + exam_score
        
    
    else:
        exam_score >= 55 and exam_score <= 100
        final_grade = 0.3*homework_average + exam_score
        
if final_grade > 100:
    final_grade = 100
print("Your final grade is:", final_grade)
Leave a Comment