What is the Best Thing - Tom Scott
basically trying to imitate this code in python to make code that ranks items based on the users input.
output 2 items from a list, ask user for which is better, add +1 score to that item, add -1 score to the other item, move on to next comparison.
new to coding, so i can understand basics but i don't understand the best way to do this.
import random
file = open('items.txt', 'r')
read = file.readlines()
modified = []
for line in read:
if line[-1] == '\n':
modified.append(line[:-1])
else:
modified.append(line)
for i in range (9999999):
randomint1 = (random.randint(0,498))
randomint2 = (random.randint(0,498))
item1 = modified[randomint1]
item2 = modified[randomint2]
print (item1, '\n'+ item2)
answer = input('item 1 or 2')
this is what i have so far, i don't know how i'd go about linking the list of items to a list of scores
ideally i could read the items in ranking of top to bottom, possibly in a created txt file with the name of items listed next to score? i'm not too sure.
any help is appreciated, thanks