Question
Modify this code I want this code to print the average grade letter import random # Function definition to calculate average def calculate_average(numbers): return sum(numbers)
Modify this code
I want this code to print the average grade letter
import random # Function definition to calculate average def calculate_average(numbers): return sum(numbers) / len(numbers) # Function definition to assign grade acoording to random number def get_letter_grade(number): if number < 60: return "F" elif number < 70: return "D" elif number < 80: return "C" elif number < 90: return "B" else: return "A"
numbers = [] for i in range(5): number = random.randint(50, 100) numbers.append(number) print(f"Random number {i+1}: {number}")
average = calculate_average(numbers) print(f"Average: {average}")
for number in numbers: letter_grade = get_letter_grade(number) print(f"Grade for {number}: {letter_grade}")
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