@valoro/

aleatorios_con_excepciones_4

Python

http://altocodigo.blogspot.com/2018/08/aleatorios-con-excepciones.html

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.12287551886593273","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyBHZW5lcmFyIG7Dum1lcm9zIGFsZWF0b3Jpb3MgcGFyZXMgZW50cmUgMTAwIHkgMTMwLCBzYWx2byAxMTAgeSAxMjAuCiMgY29uIHJlcGV0aWNpw7NuCmltcG9ydCByYW5kb20KTCA9IFtpIGZvciBpIGluIFtyYW5kb20ucmFuZGludCgxMDAsMTMwKSBmb3IgaiBpbiByYW5nZSgzMCldIGlmIGkgbm90IGluICgxMTAsMTIwKSBhbmQgaSUyPT0wXQpwcmludChMKQpwcmludChzb3J0ZWQoTCwgcmV2ZXJzZT1UcnVlKSk="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
# Generar números aleatorios pares entre 100 y 130, salvo 110 y 120.
# con repetición
import random
L = [i for i in [random.randint(100,130) for j in range(30)] if i not in (110,120) and i%2==0]
print(L)
print(sorted(L, reverse=True))