95 lines
2.0 KiB
Python
95 lines
2.0 KiB
Python
import random
|
|
import linecache
|
|
|
|
def topics():
|
|
|
|
category = random.randrange(1, 5, 1)
|
|
#print(category)
|
|
|
|
if category == 1:
|
|
|
|
#topic_file = open("topics1.txt")
|
|
|
|
topic1 = random.randrange(1, 23, 1)
|
|
#return topic1
|
|
print(linecache.getline("topics1.txt", topic1))
|
|
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 == topic1:
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 != topic1:
|
|
#return topic2
|
|
print(linecache.getline("topics1.txt", topic2))
|
|
|
|
if category == 2:
|
|
|
|
#topic_file = open("topics2.txt")
|
|
|
|
topic1 = random.randrange(1, 19, 1)
|
|
#return topic1
|
|
print(linecache.getline("topics2.txt", topic1))
|
|
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 == topic1:
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 != topic1:
|
|
#return topic2
|
|
print(linecache.getline("topics2.txt", topic2))
|
|
|
|
if category == 3:
|
|
|
|
#topic_file = open("topics3.txt")
|
|
|
|
topic1 = random.randrange(1, 22, 1)
|
|
#return topic1
|
|
print(linecache.getline("topics3.txt", topic1))
|
|
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 == topic1:
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 != topic1:
|
|
#return topic2
|
|
print(linecache.getline("topics3.txt", topic2))
|
|
|
|
if category == 4:
|
|
|
|
#topic_file = open("topics4.txt")
|
|
|
|
topic1 = random.randrange(1, 18, 1)
|
|
#return topic1
|
|
print(linecache.getline("topics4.txt", topic1))
|
|
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 == topic1:
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 != topic1:
|
|
#return topic2
|
|
print(linecache.getline("topics4.txt", topic2))
|
|
|
|
if category == 5:
|
|
|
|
#topic_file = open("topics5.txt")
|
|
|
|
topic1 = random.randrange(1, 18, 1)
|
|
#return topic1
|
|
print(linecache.getline("topics5.txt", topic1))
|
|
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 == topic1:
|
|
topic2 = random.randrange(1, 18, 1)
|
|
|
|
if topic2 != topic1:
|
|
#return topic2
|
|
print(linecache.getline("topics5.txt", topic2))
|
|
|
|
topics()
|