Naira wants to calculate the cost of two items with a discou…
Naira wants to calculate the cost of two items with a discount applied. The total cost is the sum of the two prices minus the discount amount. Below are the variables she used. What is the correct line to calculate the total cost? price1 price2 discounttotal_cost
Read DetailsThe code below takes user input and calculates average grade…
The code below takes user input and calculates average grade and letter grade. It then outputs a summary. Change the calculate average and get letter grade sections to functions. Do not use the global command. (Hint: think back to what we discussed about using return and assigning variables. You can look back at previous programs. ) ### Students enter grades, average is calculated, letter grade determined ### Program outputs a summary of the information. ### Gather student info name = input(“Enter the student’s name: “) grade1 = float(input(“Enter grade 1: “)) grade2 = float(input(“Enter grade 2: “)) grade3 = float(input(“Enter grade 3: “)) ### Calulate average average = (grade1 + grade2 + grade3) / 3 ### Determine the letter grade if average >= 90: letter_grade = “A” elif average >= 80: letter_grade = “B” elif average >= 70: letter_grade = “C” elif average >= 60: letter_grade = “D” else: letter_grade = “F” ### Display the results print(“\nStudent Report”) print(f”Name: {name}”) print(f”Average Grade: {average:.2f}”) print(f”Letter Grade: {letter_grade}”)
Read Details