-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator_textu.py
More file actions
34 lines (27 loc) · 800 Bytes
/
generator_textu.py
File metadata and controls
34 lines (27 loc) · 800 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
from random import randint, choice
f = open("vety.txt","w")
samohlasky = "aeiyou"
souhlasky = "qwrtpsdfghjklzxcvbnm"
def slovo(maxchars = 7):
slovo = ""
for i in range(randint(1, maxchars)):
if i % 2 == randint(0, 1):
slovo = slovo + choice(souhlasky)
else:
slovo = slovo + choice(samohlasky)
return slovo
def veta(minslovo = 3, maxslovo = 12):
veta = ""
for i in range(randint(minslovo, maxslovo)):
veta = veta + slovo() + " "
veta = (veta[:-1] + ".").capitalize()
return veta
def text(minvet = 3, maxvet = 10):
text = ""
for i in range(randint(minvet, maxvet)):
text = text + veta()
if randint(1, 5) == 5:
text = text + "\n"
return text
f.write(text(30, 100))
f.close()