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:...

  • 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...

  • 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...

  • # Python Please help me convert the input values to float values Code works, but the...

    # Python Please help me convert the input values to float values Code works, but the values printed need to be floats like 77.0 etc.    j_list = [] k_list = [] c_list = []    # Enter scores for Jean print("Please enter Jean's scores one by one. ") for i in range(4): j_list.append(eval(input())) print("Jeans scores:", j_list)    # Enter scores for Kayla    print("Please enter Kayla's scores one by one. ") for i in range(4): k_list.append(eval(input())) print("Kayla scores: ",...

  • PLEASE DO THIS IN PYTHON!!! Question 6 (Can you graduate? – 30 pts): Write a complete...

    PLEASE DO THIS IN PYTHON!!! Question 6 (Can you graduate? – 30 pts): Write a complete program that asks the user for their GPA (Grade Point Average) and reads that number in. If the user’s GPA is between 2.0 and 3.9, print “You can graduate.” If the GPA is 4.0 print “You’re my hero!” Otherwise, it should print “Raise your GPA!” Please indicate which language you are using to answer the question (Pseudocode, C#, Java or Python).

  • Write a program that allows the user to enter a series of exam scores. The number...

    Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop...

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
ADVERTISEMENT