1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need to write a Python program, urgent

  1. Mar 15, 2015 #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 (Text):

    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: Mar 15, 2015
  2. jcsd
  3. Mar 15, 2015 #2
    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Need to write a Python program, urgent
Loading...