Question
Python please help! Thanks you
Write a code to get an unlimited number of grades from the user (the user can press enter to finish the grades input, or use
0 0
Add a comment Improve this question Transcribed image text
Answer #1

# your code goes here
import sys
#grades list
grades=[]
#enter the loop
x=input("Enter the first grade or press enter to exit")
if not(x):
   #if no grade entered print 0
   print(0)
else:
   grades.append(int(x,10))
   while(1<2):
       print("Enter the grade or press enter or input -1 to exit ")
       #take input
       x=input()
       #if x is enter break
       if not(x):
           break
       #if x is -1 break
       elif x=="-1":
           break
       #else convert x to string and append to grades
       else:
           grades.append(int(x,10))
   #sum the grades      
   total=0
   for i in grades:
       total=total+i
   #print gpa
   print(total/len(grades))

Add a comment
Know the answer?
Add Answer to:
Python please help! Thanks you Write a code to get an unlimited number of grades from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Java, write a program that teachers can use to enter and calculate grades of individual...

    Using Java, write a program that teachers can use to enter and calculate grades of individual students by utilizing an array, Scanner object, casting, and the print method. First, let the user choose the size for the integer array by using a Scanner object. The integer array will hold individual assignment grades of a fictional student. Next, use a loop to populate the integer array with individual grades. Make sure each individual grade entered by the user fills just one...

  • Use java (I already have some of the code just I'm not the best please help!)...

    Use java (I already have some of the code just I'm not the best please help!) Write a program that will ask the user to enter 5 quiz grades. Add each quiz grade to a double variable called quizTotals. Then, calculate the average of all 5 quiz grades, and store it in a double variable called quizAverage.. Display the following output to the user: Enter quiz grade #1: Enter quiz grade #2: Enter quiz grade #3: Enter quiz grade #4:...

  • You will create a Grade Program that will calculate students’ weighted averages. You are going to...

    You will create a Grade Program that will calculate students’ weighted averages. You are going to have the user enter lab grades, test grades, and project grades. You will then display a grade report of each individual average along with their overall average and letter grade. Ask the user to enter their lab grades. Call the averageGrade function that will allow the user to enter their grades and calculate their average. averageGrade Function: This will pass the average back to...

  • Has to be written in Python 3 GPA calculator: Assume the user has a bunch of...

    Has to be written in Python 3 GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will use a while loop and after getting the data of one...

  • please code in python 1. Write a program to request the user enter a desired number...

    please code in python 1. Write a program to request the user enter a desired number of values. Create a loop to load the desired number of user-specified values into a list. Create two lists with the same values but generated in different ways. On list will be originally initialized to have the desired length before entering the loop. The other list will begin empty and values be appended for every iteration of the loop. Output from the program should...

  • In this assignment you are asked to write a python program to maintain the Student enrollment...

    In this assignment you are asked to write a python program to maintain the Student enrollment in to a class and points scored by him in a class. You need to do it by using a List of Tuples What you need to do? 1. You need to repeatedly display this menu to the user 1. Enroll into Class 2. Drop from Class 3. Calculate average of grades for a course 4. View all Students 5. Exit 2. Ask the...

  • Write a java program to read a list of exam grades given as int's in the...

    Write a java program to read a list of exam grades given as int's in the range of 0 to 100. Your program will display the total number of grades and the number of grades in each letter-grade category as follows: A 93 <= grade <= 100 A- 90 <= grade < 93 B+ 87 <= grade < 90 B 83 <= grade < 87 B- 80 <= grade < 83 C+ 77 <= grade < 80 C 73 <=...

  • Write a C++ Program. you were required to first create a function called average. The return...

    Write a C++ Program. you were required to first create a function called average. The return type is double and it takes in two parameters, one of type string the other of type double. In the average function write a for loop that PROMPT THE USER to enter in a grade 5 times, keep a sum of all the different grades then return the average of the grades. (sum / 5) Next write a function of type double called lowest...

  • Having trouble with python! Write a program to build a list of grades, print them out,...

    Having trouble with python! Write a program to build a list of grades, print them out, add to them and count occurrences, and find the amount of the 2-digit grade values. Here are the criteria a) Your program “L6QI initials.py" must start with a commented ID Box AND include a comment that indicates the e of the program. EACH of the five functions in your program must state its purpose in comments too The main function in your program must...

  • Can you help me write a Python 3.7 code for this question? Write a program using...

    Can you help me write a Python 3.7 code for this question? Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user: The list of integers The lowest number in the list The highest number in the list The total sum of all the numbers in the list The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT