Advertisement
facedwarrior193

High score updating system

Jun 3rd, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def updatesc(sc):
  2.   f = open("yes.txt")
  3.   content = f.read()
  4.   f.close()
  5.   if content == "":
  6.     f = open("yes.txt","w")
  7.     f.write(str(sc))
  8.     print("Thats ur first high score!")
  9.   else:
  10.     if int(sc) > int(content):
  11.       f = open("yes.txt","w")
  12.       f.write(str(sc))
  13.       f.close()
  14.       print("Updated!")
  15. a = input("Enter a number")
  16. updatesc(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement