抽獎程式原始碼

import time
import random
file = open('225python.txt', 'r', encoding='UTF-8')
peopleList=[];
for line in file.readlines():
	peopleList.append(line)
file.close()
seconds = list(i for i in range(1,11));
seconds.reverse()

print('抽獎開始 倒數10秒')
for i in list(seconds):
	print(i)
	time.sleep(1)

result=random.sample(peopleList,2);
print('恭喜以下兩位:n',result[0],result[1])

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *