I'm using python, and I'm not sure how to print this Your total is 22 out of 30, or 73.33%. Also, how can i use the for loop on this- Write an algorithm that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calcuate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. Sample input and output is shown below: How many exercises to input? 3 Score received for exercise 1: 10 Total points possible for exercise 1: 10 Score received for exercise 2: 7 Total points possible for exercise 2: 12 Score received for exercise 3: 5 Total points possible for exercise 3: 8 Your total is 22 out of 30, or 73.33% This is what I have: possScores = 0 sumOfScores = 0 totalScores = 0 numOfExer = int(input("How many exercises to input? ")) # Taking number 1 from user as int exer1 = int(input("Score received for exercise 1: ")) possScores1 = int(input("Total points possible for exercise 1: ")) # Taking number 2 from user as int exer2 = int(input("Score received for exercise 2: ")) possScores2 = int(input("Total points possible for exercise 2: ")) # Taking number 3 from user as int exer3 = int(input("Score received for exercise 3: ")) possScores3 = int(input("Total points possible for exercise 3: ")) # adding num1 and num2 and storing them in # variable addition sumOfScores = exer1 + exer2 + exer3 possScores = possScores1 + possScores2 + possScores3 totalScores = sumOfScores/possScores # printing print("Your total is ", sumOfScores,"out of ",possScores, "or ")
I'm using python, and I'm not sure how to print this Your total is 22 out of 30, or 73.33%. Also, how can i use the for loop on this-
- Write an
algorithm that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calcuate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. Sample input and output is shown below:
How many exercises to input? 3
Score received for exercise 1: 10
Total points possible for exercise 1: 10
Score received for exercise 2: 7
Total points possible for exercise 2: 12
Score received for exercise 3: 5
Total points possible for exercise 3: 8
Your total is 22 out of 30, or 73.33%
This is what I have:
possScores = 0
sumOfScores = 0
totalScores = 0
numOfExer = int(input("How many exercises to input? "))
# Taking number 1 from user as int
exer1 = int(input("Score received for exercise 1: "))
possScores1 = int(input("Total points possible for exercise 1: "))
# Taking number 2 from user as int
exer2 = int(input("Score received for exercise 2: "))
possScores2 = int(input("Total points possible for exercise 2: "))
# Taking number 3 from user as int
exer3 = int(input("Score received for exercise 3: "))
possScores3 = int(input("Total points possible for exercise 3: "))
# adding num1 and num2 and storing them in
# variable addition
sumOfScores = exer1 + exer2 + exer3
possScores = possScores1 + possScores2 + possScores3
totalScores = sumOfScores/possScores
# printing
print("Your total is ", sumOfScores,"out of ",possScores, "or ")
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images