Help with Python Program: Calculate Student Grades & Averages

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 2K views
acurate
Messages
17
Reaction score
1
I really need help with a big Python program. Our professor has been MIA for the whole term and now we need to submit a program. I thought I was doing and learning fine on my own, but the program simply does not work for me.

I need it till Thursday and I am ripping my hair out because I cannot afford getting a bad grade on this work.

The program is

Using the input function, the program asks to enter a student's name, then a grade (there has to be a few grades because you will need to count the average of every student). The program asks the person to keep on entering the grade until the grade is entered correctly (that means the grade cannot go higher than 10). When the name and number is entered correctly, the program asks to enter a new name and grade. The cycle is broken off when a 0 is entered.

The grades are listed by the name (from A - Z).

At the end of the program there has to be this information written about every student (name):

Name, his grades and the average of his given grades.

There has to be #comments made in the program to explain what you did.


Thank you for anyone that can help! I'm in a crisis.

Here's how I think it should start but I am not sure, even hints or SUGGESTIONS will be fine.

Code:
class Student(object):
    def__init__(self, name, grades, average):
        self.grade = grade
        self.average = average

        def __str__(self)
        return "Name {0}, Grade {1}, Average {3}".format (self.name, self.grade, self.average)def startalgorithm():
    student = []
    While True:
        student = input("Insert your name:" )
        if student[0] == "1": #i don't really know how to break a cycle off without having to write every number separately
            break

This is the part where I'm stuck at since I do not know if I am going on this the right way and I keep getting messages of invalid syntax, any hints?
 
Last edited:
on Phys.org
You'll have to give more information about what loops you're using and what the error messages are, and then we can nudge you in the right direction.