Question
How do I fix this program to run it in python? It keeps giving me the error of expected an indented block . def main():
How do I fix this program to run it in python? It keeps giving me the error of "expected an indented block ".
def main():
#gets grade 1
grade1 = int(input('Enter your first grade: '))
# determines the grade
determine_grade(grade1)
#gets grade 2
grade2 = int(input('Enter your second grade: '))
# determines the grade
determine_grade(grade2)
#gets grade 3
grade3 = int(input('Enter your third grade: '))
# determines the grade
determine_grade(grade3)
#gets grade 4
grade4 = int(input('Enter your fourth grade: '))
# determines the grade
determine_grade(grade4)
#gets grade 5
grade5 = int(input('Enter your fifth grade: '))
# determines the grade
determine_grade(grade5)
#calculates average score
average = calc_average(grade1, grade2, grade3, grade4, grade5)
#displays overall average score and grade
print (" Average score and results")
#displays score
print ("score :" ,average)
#determine grade
determine_grade(average)
#function to calculate average of the given marks
def calc_average(grade1, grade2, grade3, grade4, grade5):
average_score = (grade1 + grade2 + grade3 + grade4 + grade5) / (5.0)
return average_score
#function to determine the grade based on the score
def determine_grade(score):
if(score < 60):
print "your grade is an F"
elif(score >= 60 and score <=69):
print "your grade is a D"
elif(score >=70 and score <=79):
print "your grade is a C"
elif(score >=80 and score <=89):
print "your grade is a B"
elif(score >=90 and score<=100):
print "your grade is an A"
else:
print 'Error: you have not entered a number between 0 and 100.'
return score
main()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started