-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerators.py
More file actions
54 lines (45 loc) · 1.23 KB
/
generators.py
File metadata and controls
54 lines (45 loc) · 1.23 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
53
54
def gen_simpl_num():
num = 2
while True:
for i in range(1, num + 1):
if num != i and num % i == 0 and num / i != num:
break
if num // i != 0 and num / i == 1:
yield num
num += 1
g = gen_simpl_num()
print(*(next(g) for i in range(20)))
'''
import random
from string import ascii_lowercase, ascii_uppercase
# установка зерна датчика случайных чисел (не менять)
#random.seed(1)
N = int(input())
# здесь продолжайте программу
chars = ascii_lowercase + ascii_uppercase + "0123456789!?@#$*"
def gen_pass(N):
"""Password generator"""
while True:
password = ''
for i in range(N):
indx = random.randint(0, len(chars) - 1)
password += chars[indx]
yield password
g = gen_pass(N)
print(*(next(g) for i in range(9)), sep='\n')
'''
'''
N = 9
def gen(N):
a, b, c = 1, 1, 1
for i in range(1, N + 1):
d = a + b + c
if i < 4:
# d = 1
yield 1
else:
yield d
a, b, c = b, c, d
g = gen(N)
print(*(next(g) for i in range(1, N + 1)), end=' ')
'''