0
# VARIABLE DEFINITIONS
name=""
adress=""
city=""
state=""
zipcode=""
course1=""
course2=""
course3=""
course4=""
course5=""



#-----------------------------------------------------------------------
# CONSTANT DEFINITIONS
courses= "Enter courses name (Type 'STOP' when finished) :"
pointsR = "\tEnter points received ( Type '9999' when finished) :"
pointsP = "\tEnter points possible for this assignment :"
#-----------------------------------------------------------------------
# FUNCTION DEFINITIONS

#-----------------------------------------------------------------------
# PROGRAM'S MAIN LOGIC



        print "GRADE CALCULATOR PROGRAM"
        print
        name = raw_input("Enter your first and last name:").title()
        adress =raw_input("Enter your street adress:").title()
        city = raw_input("Enter your city:").title()
        state = raw_input("Enter your state  abbreviation:").upper()
        zipcode= raw_input("Enter your zip code:")
        print
        course = raw_input(courses).upper()
        loopcounter=0
        totalPossiblePoints=0
        totalPoints=0
        while course != "STOP" and loopcounter <5:
            loopcounter +=1
            pointsReceived= float (raw_input(pointsR))
            while pointsReceived !=  9999:
                     pointsReceived+=totalPoints
                     pointsPossible = float (raw_input(pointsP))
                     pointsPossible+= totalPossiblePoints
                     pointsReceived= float(raw_input(pointsR))

            course=(course1,course2,course3,course4,course5)
            totalPossiblePoints=0
            totalPoints=0
            if loopcounter < 5:
                    course= raw_input(courses).upper()
        print
        print
        print name
        print adress
        print (city), (state) (zipcode)
        print
        print courses
        print overallGpa

Edited by pyTony: Use code block for code in future, please!

4
Contributors
8
Replies
51
Views
4 Years
Discussion Span
Last Post by woooee
-2

Congratulations! You're no longer a DaniWeb newbie.<br /> <br />
Your DaniWeb account has just been upgraded from newbie status and now you have the ability to take advantage of everything the community has to offer.<br /> <br />
You can now enjoy an advertisement-free DaniWeb by ticking the checkbox to Disable Ads in your profile. You will no longer have to fill out the human verification check when you post. You can also now send unlimited private messages, contribute new code snippets, and tag articles with never-before-used tags.

0

my code had me stuck at the point where im suppose store and average

0

Check the link , my problem happens when I have the user enter class and assigments and not knowing how to store it all in appropiate variables. I tried to follow the pseudo code that he has on the assignment but Im stuck

Edited by Fernando_1

0

First of all you do not need the first 20 lines, it is clearer to use the messages directly in were they are used, global variables/constants are bad idea (with few exceptions to rule). You can find this True when you see what you are doing at line 60 (vs line 17) Actually you have extra indent at line 28 for the main program that stops whole program running. Remove indent or add line

if __name__ == '__main__':

before main code. This is good habit.

Edited by pyTony

0

This is backwards

pointsPossible+= totalPossibePoints

as totalPossiblePoints will always stay at zero and pointsPossible will be over-written on the next input through the loop. If you want to average then you also have to keep track of how many were entered so you can divide total by number entered. Also there is no course1, course2, etc. entered. As the courses are entered append them to a list and keep them that way. That is what lists are for Click Here

Edited by woooee

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.