Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

jump to level 1 given grade1, grade2, and grade3 read from input, compu…

Question

jump to level 1
given grade1, grade2, and grade3 read from input, compute the average and assign avg_grade with the result.
click here for example
1 grade1 = int(input())
2 grade2 = int(input())
3 grade3 = int(input())
4
5
6
7 print(f\average grade: {avg_grade:.2f}\)

Explanation:

Step1: Calculate sum of grades

$grade1 + grade2 + grade3$

Step2: Compute average of 3 grades

$\text{avg_grade} = \frac{grade1 + grade2 + grade3}{3}$

Answer:

Add the following line as line 5 in the code:

avg_grade = (grade1 + grade2 + grade3) / 3

The complete code will be:

grade1 = int(input())
grade2 = int(input())
grade3 = int(input())
avg_grade = (grade1 + grade2 + grade3) / 3
print(f"Average grade: {avg_grade:.2f}")