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 nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
- Please answer in python with showing the codesarrow_forwardUsing the Python language answer the following questions below. Please tell me what program you use if it is IDLE or Atom or a python website please provide the website you use.arrow_forwardWrite a program finding the smallest even integer that is divisible by 13 and by 16 whose square root is greater than 120. For that apply a loop structure starting from 1 and stoping when the number is found. The program displays the message "Ilgili sayn: " and then displays the number.arrow_forward
- write an algorithm code it in Python Tuition Fees Increase In 2008, BC charged $115 per credit for a course. BC announced it would increase its cost per credit by 4% each year for the next five years. Write a program that uses a for loop to display the projected rates for the next five years as follows: Year Cost per Credit -------------------------- 2008 $115.00 2009 $119.60 2010 $124.38 2011 $129.36 2012 $134.53 2013 $139.92 ============================================================================ Pay attention to the spacing/alignment in your output. Review the Formatting Output in Python documentation in order to properly format the numerical values in your output. The output should present with two decimal places. Include your algorithm as section comments in your Python code. Upload the Python (*.py) file here.arrow_forwardComputer Science Write correct Python code to complete the following task. Document all assumptions. Solutions that do not incorporate a loop will receive a grade of 0. Obtain a positive integer greater than 1 but less than 20 from the user. Calculate the product of all numbers starting from the user's number up to, and including 100. If the number is evenly divisible by 7, do not include it in the product. If the product is more than or equal to 5000 stop the loop early and show the message "a big product". When the loop ends, if the product is less than 5000 show the product to the user.arrow_forwardPlease write the code in Python using input, if, and else statements. Please include sample run 1 and 2. Thanks!arrow_forward
- In Python using the Pandas Module: Find the Player with the Highest Batting Average from 2019, only if their number of plate appearances (PA) >= 250. Plate Appearances (Pl_App), calculated as: Pl_App = HBP + SH + SF + AB + BB + Batting Average (B_AVG) is the ratio of Hits to at Bats. So B_AVG = H / AB, and is reported to three decimal points. Show code and output to prove functionality. Below is 3 years of player data: player year team lg G AB R H HR BB SO IBB HBP SH SF Alan J. 2020 NYA AL 2 0 0 0 0 0 0 0 0 0 0 Barry B. 2020 HOU AL 4 0 0 0 0 0 0 0 0 0 0 Michael J. 2020 CHA AL 60 240 43 76 19 18 59 1 3 0 1 Jim R. 2020 ATL NL 46 160 46 40 14 38 60 2 4 0 0 Nolan R. 2020 TBA AL 54 185 29 48 8 20 74 0 0 0 0 Sammy S. 2020 CHN NL 13 0 0 0 0 0 0 0 0 0 0 Frank T. 2020 SDN NL 3 1 0 0 0 0 1 0 0 0 0 Alan J. 2019 KCA AL 6 0 0 0 0 0 0 0 0 0 0 Barry B. 2019 ATL NL 16 49 4 9 2 2 18 0 0 0 0 Michael J. 2019 LAA AL 38 124 9 20 3 7 55 0 1 0 0 Jim R. 2019 MIN AL 44 89 10 17 0…arrow_forwardPYTHON Question 4: Sum of the first N natural numbers: Part 1: Write a function sumNaturals (n) that returns the sum of the first n natural numbers. You can use this formula 1 + 2 + ... + n = n(n+1) / 2. Make sure that the function returns an integer. Do not use a for loop or a while loop. def sumNaturals(n): """ Sum all the first n natural numbers. >>> sumNaturals(3) # 1 + 2 + 3 = 6 6 >>> sumNaturals(5) # 1 + 2 + 3 + 4 + 5 = 15 15 """ *** YOUR CODE HERE *** Part 2: Define a lambda expression that takes n and returns the sum of the first n natural numbers, using the above formula.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education