umfragebot/bot.py

21 lines
434 B
Python
Executable file

#!/usr/bin/env python3
import random
def runner():
print(forge)
def percentage():
return random.randint(0, 100)
def readfiles(file1 = "part1.txt", file2 = "part2.txt", file3 = "part3.txt"):
for f in (file1, file2, file3):
with open(f) as o:
yield o.readlines()
def forge():
pa, pb, pc = (random.choice(i).strip() for i in readfiles())
return "%i%% %s %s %s" % (percentage(), pa, pb, pc)