@valoro/

aleatorios_con_excepciones_1

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.654246698438059","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyBHZW5lcmFyIG7Dum1lcm9zIGFsZWF0b3Jpb3MgcGFyZXMgZW50cmUgMTAwIHkgMTMwLCBzYWx2byAxMTAgeSAxMjAuCiMgY29uIHJlcGV0aWNpw7NuCmltcG9ydCByYW5kb20KTCA9IFtdCmZvciBpIGluIHJhbmdlKDE2KToKICAgIHggPSByYW5kb20ucmFuZHJhbmdlKDEwMCwxMzEsMikKICAgIGlmIHggbm90IGluICgxMTAsMTIwKToKICAgICAgICBMLmFwcGVuZCh4KQpwcmludChMKQpwcmludChzb3J0ZWQoTCkp"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
# Generar números aleatorios pares entre 100 y 130, salvo 110 y 120.
# con repetición
import random
L = []
for i in range(16):
    x = random.randrange(100,131,2)
    if x not in (110,120):
        L.append(x)
print(L)
print(sorted(L))