@valoro/

palabras_random_2

Python

https://altocodigo.blogspot.com/2018/08/generar-y-ordenar-palabras-en-python.html

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.1543505691611251","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHJhbmRvbQpuPTMgIyBuwrogZGUgcGFyZWphcyBkZSBsZXRyYXMgY29uc29uYW50ZS12b2NhbApjPSdiY2RmZ2hqa2xtbnBxcnN0dnd4eXonCnY9J2FlaW91JwpMPVtdCmZvciBpIGluIHJhbmdlKDEwKToKICBwYWxhYnJhPScnCiAgZm9yIGogaW4gcmFuZ2Uobik6CiAgICBwYWxhYnJhKz0nJy5qb2luKHJhbmRvbS5jaG9pY2UoYykpCiAgICBwYWxhYnJhKz0nJy5qb2luKHJhbmRvbS5jaG9pY2UodikpCiAgTC5hcHBlbmQocGFsYWJyYSkKcHJpbnQoTCkKcHJpbnQoc29ydGVkKEwpKQ=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
import random
n=3 # nº de parejas de letras consonante-vocal
c='bcdfghjklmnpqrstvwxyz'
v='aeiou'
L=[]
for i in range(10):
  palabra=''
  for j in range(n):
    palabra+=''.join(random.choice(c))
    palabra+=''.join(random.choice(v))
  L.append(palabra)
print(L)
print(sorted(L))