repl.it
@will_johnson/

highscore testing with sorting

Python

No description

fork
loading
Files
  • main.py
  • test.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fh = open("test.txt", "w")
array = ["1", "3", "2", "4", "5"]
fh.write(str(array))
fh.close()
fh = open("test.txt", "r")
array2 = fh.readline()
fh.close()
print(array2)
translation_table = dict.fromkeys(map(ord, "[],'"), None)
array2 = array2.translate(translation_table)
array2 = array2.split()
array2.sort(reverse = True)
print(array2)
fh = open("test.txt", "w")
fh.write(str(array2))
fh.close()
Fetching token
?