Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import random
with open('words.txt', 'r') as f:
data = f.readlines()
random.shuffle(data)
repeat_limit = 0
start = random.randint(0, len(data) - 1)
data1 = data[:start]
data2 = data[start:]
data = data2 + data1
for i, d in enumerate(data):
x = raw_input(str(i + 1) + ". " + d.strip() + " - ")
if x == "repeat":
repeat_limit = i + 1
break
if repeat_limit > 0:
print "Repeating words!"
new_list = data[:repeat_limit]
random.shuffle(new_list)
for i, d in enumerate(new_list):
x = raw_input(str(i + 1) + ". " + d.strip() + " - ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment