66.1k views
5 votes
You want to write a Python program to compute the average of three integer quiz grades for a single student. Decide what variables your program needs, and create them with appropriate initial values

1 Answer

2 votes

Answer:

Here is code in python.

#define three variables to store grades

grade_1 = 0

grade_2 = 0

grade_3 = 0

//define variable to store average of all three quiz

avg_grade=0

// read score of 1st quiz as integer

grade_1 = int (input ("please enter score of first quiz: "))

// read score of 2nd quiz as integer

grade_2 = int (input ("please enter score of second quiz: "))

// read score of 3rd quiz as integer

grade_3 = int (input ("please enter score of third quiz: "))

//calculate average of three grades

avg_grade = (grade_1 + grade_2 + grade_3)/3

// print the average

print ("Average of three quizs is {}".format(avg_grade))

Step-by-step explanation:

Declare three variables "grade_1","grade_2" and "grade_3" to store the score of 3 quiz. And variable "avg_grade" to store the average of all quiz.Read score of quiz as integer and then calculate their average and assign it "avg_grade".

Output:

please enter score of first quiz: 23

please enter score of second quiz: 33

please enter score of third quiz: 45

Average of three quiz is 33.6666

User Payam
by
8.3k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.