Question: 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
Get step-by-step solutions from verified subject matter experts
