I am new to programming and trying create a program that will be able to input students test scores. After this another prompt will ask you for the students name who received that score. When finished inputting, the program should tell me the highest score and lowest score, along with who received those scores. The scores will be in integers and not letters. Hope this is understandable because I have yet to learn these steps and lost!!

name = raw_input("Please enter a name")
score = raw_input("Please enter a score")

top_name = ""
top_score = score

bottom_name = name
bottom_score = score

running = True

while(running == True):

    name = raw_input("Please enter a name")

    if (name == "exit"): # type "exit" when it asks for a name to end the script

        running = False
        break
        
    score = raw_input("Please enter a score")

    if(score > top_score):
        top_score = score
        top_name = name

    elif(score < bottom_score):
        bottom_score = score
        bottom_name = name
        
print "Top score = " + str(top_score) + " scored by " + top_name
print "Bottom score = " + str(bottom_score) + " scored by " + bottom_name

If your new to coding the first thing you should do is find out why I have done what I have done.

use keywords from the script to refine your searches.
search python "if statements" "print function" and "variables" to get started

Edited 5 Years Ago by Archenemie: n/a

This article has been dead for over six months. Start a new discussion instead.