@valoro/

aleatorios_con_excepciones_2

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.2708307694448817","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyBHZW5lcmFyIG7Dum1lcm9zIGFsZWF0b3Jpb3MgcGFyZXMgZW50cmUgMTAwIHkgMTMwLCBzYWx2byAxMTAgeSAxMjAuCiMgY29uIHJlcGV0aWNpw7NuCmltcG9ydCByYW5kb20KTD1bciBmb3IgciBpbiBbcmFuZG9tLnJhbmRpbnQoMTAwLDEzMCkgZm9yIHMgaW4gcmFuZ2UoMzApXSBpZiByJTI9PTAgYW5kIHIgbm90IGluICgxMTAsMTIwKV0KcHJpbnQoTCkKcHJpbnQoc29ydGVkKEwpKQ=="},"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=[r for r in [random.randint(100,130) for s in range(30)] if r%2==0 and r not in (110,120)]
print(L)
print(sorted(L))