...

/

Solution: Score Logger

Solution: Score Logger

We'll cover the following...

This program lets a player enter their name and score, saves it to a file, and then reads the file to show all saved scores.

C++
name = input("Player name: ")
score = input("Score: ")
with open("scores.txt", "a") as file:
file.write(name + ":" + score + "\n")
with open("scores.txt", "r") as file:
content = file.read()
print(content)
  • input() asks ...