You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

scores.py 567 B

12345678910111213141516171819202122232425262728
  1. def parse_scores():
  2. res = dict()
  3. with open("scores.txt") as file:
  4. for line in file.readlines():
  5. name, score = line.split()
  6. res[name] = int(score)
  7. return res
  8. def print_scores(scores):
  9. print("Tableau des résultats:")
  10. for name, score in scores.items():
  11. print(name, score)
  12. def register_score(scores, name, new_score):
  13. pass
  14. def main():
  15. scores = parse_scores()
  16. name = input("nom: ")
  17. new_score = input("score: ")
  18. register_score(scores, name, new_score)
  19. print_scores(scores)
  20. main()