total = 0
max_score = -1
min_score = 100000000
total_numbers = 0
x = 0
y = 0
print("Enter a list of numbers, (Enter -1 to stop) ")
print ("Press the enter key after entering each number")
print ("End the list by entering -1")
print ()
number = int(input(""))
while number != -1:
    total = total + number
    if number > max_score:
        max_score = number
    if number < min_score:
        min_score = number
    total_numbers = total_numbers + 1
    average = total / total_numbers
    if x < average:
        x = x + 1
    if number <= 50:
        y = y + 1
    number = int(input(""))
    continue
print ()
print ("You have entered "  + str(total_numbers) + " scores ")
print ()
print ("The top score is " + str(max_score))
print ()
print ("The lowest score is  " + str(min_score))
print ()
print ("The class average is %0.3f  " % (average))
print ()
print (str(x) + " students scored above the class average ")
print (str(y) + " students passed the final exam ")
while 1:
    print ()
    if 'y' in input("Do you want to run the program again? (y/n) "):
        pass
    else:
        print ()
        print ('Thank you for using this program!')
        print ()
        print ('Goodbye!')
        break
    print("Enter a list of numbers, (Enter -1 to stop) ")
    print ("Press the enter key after entering each number")
    print ("Signal the end of the list by entering -1")
    print ()
    number = int(input(""))
    max_score = -1
    min_score = 100000000
    total = 0
    total_numbers = 0
    x = 0
    y = 0
    while number != -1:
        total = total + number
        if number > max_score:
            max_score = number
        if number < min_score:
            min_score = number
        total_numbers = total_numbers + 1
        average = total / total_numbers
        if x < average:
            x = x + 1
        if number <= 50:
            y = y + 1
        number = int(input(""))
        continue
    print ()
    print ("You have entered "  + str(total_numbers) + " scores ")
    print ()
    print ("The top score is " + str(max_score))
    print ()
    print ("The lowest score is " + str(min_score))
    print ()
    print ("The class average is %0.3f  " % (average))
    print (str(x) + " students scored above the class average ")
    print (str(y) + " students passed the final exam ")

how many people scored above average - how do i find this?
how many people passed the course (i.e. scored >= 50) - how do i find this?

Please help, thanks

Tony

PLEASE! Use code tags! If you look at your post, you realize your Python code has no indentation anymore, and indentation is a crucial part of Python. I'm not going to bother looking through your code until you edit that post and put your code in those tags to preserve the spacing.

Edited 3 Years Ago by happygeek: fixed formatting

Comments
Well said!

Are you using a 32-bit compiler or a 16-bit?
If 16-bit then you have a problem!


100000000
is 05f5e100 in hex requiring 32-bits to store. Since you are being signed due to the -1, It seems a Highes score of 32767 would be a more suitable test, IFF you are using a 16-bit compiler!

Are you using a 32-bit compiler or a 16-bit?
If 16-bit then you have a problem!


100000000
is 05f5e100 in hex requiring 32-bits to store. Since you are being signed due to the -1, It seems a Highes score of 32767 would be a more suitable test, IFF you are using a 16-bit compiler!

This is Python, the interpreter handles very large integer values only limited by available memory.

Comments
Yes :)
This question has already been answered. Start a new discussion instead.