-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution
More file actions
39 lines (35 loc) · 968 Bytes
/
solution
File metadata and controls
39 lines (35 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from random import randint
def court_over_time(years):
court = {}
for i in range(9):
court[i] = 0
senate = randint(1,2)
pres = randint(1,2)
v = 0
for i in range(years):
if years % 4 == 0:
pres = randint(1,2)
if years % 2 == 0:
senate = randint(1,2)
x = False
if senate == pres:
x = True
for key in court:
court[key] -= 1
if court[key] <= 0:
if x == True:
court[key] = randint(0,40)
for key in court:
if court[key] <= 0:
v += 1
return v
def over_time_over_time(years, times):
total_v = 0
for i in range(times):
total_v += court_over_time(years)
times = float(times)
return total_v / times
print over_time_over_time(10000,10000)
print over_time_over_time(10000,10000)
print over_time_over_time(10000,10000)
print over_time_over_time(10000,10000)