Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a python code and I'm getting Process finish with exit code 0. Problem is I'm not being asked to input any information, unlike
I have a python code and I'm getting Process finish with exit code 0. Problem is I'm not being asked to input any information, unlike what is supposed to be doing. its supposed to ask me to enter 6 numbers and get the average. why isn't it asking me for input>
def main(): total=0 for i in range(0,6): while (True): grade = int(input('Enter grade: ')) if(isInvalidScore(grade)): print('Enter valid grade') continue else: break total += grade avg = calc_average(total) print('Average grade is: ', avg) def calc_average(total): return total / 6 def isInvalidScore(score): status = True if score < 0 or score > 100: status = True else: status = False return status #2nd part: def main(): num=int(input('How many grades do you have')) total=0 for i in range(0,num): while (True): grade = int(input('Enter grade: ')) if(isInvalidScore(grade)): print('Enter valid grade') continue else: break total += grade avg = calc_average(total,num) print('Average grade is: ', avg) def calc_average(total, num): return total / num def isInvalidScore(score): status = True if score < 0 or score > 100: status = True else: status = False return status
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