Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

Draft a business plan.

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago