Question
Was wondering if this can be re-written to not have any formats? def main(): for i in range(5): print(Enter test score {0}:.format(i+1)) scores.append(float(input())) return scores
Was wondering if this can be re-written to not have any formats?
def main(): for i in range(5): print("Enter test score {0}:".format(i+1)) scores.append(float(input())) return scores
def determine_grade(num): if 90 <= num <= 100: letter_grade = "A" elif 80 <= num <= 89: letter_grade = "B" elif 70 <= num <= 79: letter_grade = "C" elif 60 <= num <= 69: letter_grade = "D" else: letter_grade = "F" return letter_grade
def calc_average(grades): average = sum(grades) / len(grades) grade = determine_grade(average) print("Average: \t {:.1f} \t {}".format(average, grade))
scores=[] name = input("Enter the student name: ") lst = main() print("==============================================================") print(" ====Welcome to Grade and Average test score==== ")
print("==============================================================") print() print("--------------------------------------------------------------") print("Student Name: {0}".format(name)) print("--------------------------------------------------------------") print(" Test \t Numeric Grade \t Letter Grade") print(" ---- \t ------------- \t ------------") for n in lst: print(" \t {:.1f} \t\t {} ".format(n, determine_grade(n))) print("--------------------------------------------------------------")
calc_average(lst)
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