1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| from random import * from time import *
data1 = (2016,1,1,0,0,0,-1,-1,-1) time1 = mktime(data1) data2 = (2017,1,1,0,0,0,-1,-1,-1) time2 = mktime(data1)
random_time = uniform(time1,time2) print(random_time,type(random_time))
print(asctime(localtime(random_time)))
num = int(input('How many dice?')) sides = int(input('How many sides per die?')) sum = 0 for i in range(num): sum += randrange(sides) + 1 print('The %sth all_result is'%(i+1),sum)
|