forked from psounis/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise2.py
More file actions
52 lines (37 loc) · 1.01 KB
/
exercise2.py
File metadata and controls
52 lines (37 loc) · 1.01 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
from random import seed
from random import randrange
from datetime import datetime # all 3 at the beginning
seed(datetime.now()) # once, before randint call
i = 0
columns = []
while True:
column = set()
# 10-19
rand_number = randrange(10,20)
column.add(rand_number)
while True:
rand_number = randrange(10,20)
if rand_number not in column:
column.add(rand_number)
break
# 20-39
rand_number = randrange(20,40)
column.add(rand_number)
while True:
rand_number = randrange(20,40)
if rand_number not in column:
column.add(rand_number)
break
# 1-9 EVEN
rand_number = 2 * randrange(1,5)
column.add(rand_number)
# 41-49 ODD
rand_number = randrange(41,49+1,2)
column.add(rand_number)
if column not in columns:
columns.append(column)
i += 1
if i==10:
break
for column in columns:
print(column)