Member Avatar for robert.montgomery.75054

Okay, I thought I had this code solved: please help me..My code is not closing out..please point me to the right direction..very newbie to python

# initialization phase
count = 0
totalGrade = 0.0

toContinue = "yes"
while toContinue != "no":
    moreStudents = "y"

#processing phase
    moreGrades = "y"
    while moreGrades != "n":
        grade = int(input("Enter a test grade: "))
        totalGrade = totalGrade + grade
        moreGrades = input("Are there any more test grades to enter, 'y' or 'n'? ")
        count = count + 1

# termination phase
    average = totalGrade/count



    print("The average is", round(average, 1))
    toContinue = str(input("Are there any more students 'y' or 'n'?"))
print("I am done.")

You ask for "y/n" but test for "no"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.