I realize this is a fairly generic type of question, but being new to
programming, I'm not sure how best to approach it.

I'm doing a tutorial and was given a problem, using shelve.  It's taking a
user name and then asking for scores in a game, until you end the loop.
 Whatever score is the high score, should be returned from the function:

Here is what I have so far:

import shelve

def user_scores():
  user_name = input ("What is the user name?").rstrip()
  scores = int(input("What is the users score, enter 0 if done"))
  shelf = shelve.open('scores.py', writeback=True)
  score = [scores]
  user = {user_name:score}
  shelf['user'] = user
  shelf.close()
  while scores > 0:
    scores = int (input("What is the next score"))
    shelf = shelve.open('scores.py', writeback=True)
    score.append(scores)
    shelf['score'] = score
    shelf.sync()
    shelf.close()

What I'm not sure of is how to compare the values of score, to find and
print the one that is highest.  Any suggestions?

Becky
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to