@valoro/

series_2

Python

http://altocodigo.blogspot.com/2018/08/series-en-python.html

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.9342080318177686","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHJhbmRvbQpyYW5kb20uc2VlZCgpICNiYXJhamFtb3MgbGEgc2VyaWUgZGUgbsO6bWVyb3MgYWxlYXRvcmlvcwppbmljaWFsPXJhbmRvbS5yYW5kaW50KDEwMCwxMzApCmZpbmFsPWluaWNpYWwrcmFuZG9tLnJhbmRpbnQoMTAsMjApCmludGVydmFsbz1yYW5kb20ucmFuZGludCgyLDUpCnByaW50KCdpbmljaWFsPScsaW5pY2lhbCkKcHJpbnQoJ2ZpbmFsPScsZmluYWwpCnByaW50KCdpbnRlcnZhbG89JyxpbnRlcnZhbG8pCmk9aW5pY2lhbApMPVtdICNpbmljaWFsaXphbW9zIEwgY29tbyB1bmEgbGlzdGEgdmFjw61hCnRvdGFsPTAgI2luaWNpYWxpemFtb3MgbGEgc3VtYSBhIGNlcm8Kd2hpbGUgaTxmaW5hbDoKICBMLmFwcGVuZChpKSAjYcOxYWRpbW9zIGVsIHZhbG9yIGkgYSBsYSBsaXN0YSBMCiAgaSs9aW50ZXJ2YWxvICNhdW1lbnRhbW9zIGVsIHZhbG9yIGRlbCBjb250YWRvcgogIHRvdGFsKz1pCnByaW50KEwpICNpbXByaW1pbW9zIGxhIGxpc3RhCnByaW50KCdMYSBzdW1hIGVzOicsdG90YWwp"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import random
random.seed() #barajamos la serie de números aleatorios
inicial=random.randint(100,130)
final=inicial+random.randint(10,20)
intervalo=random.randint(2,5)
print('inicial=',inicial)
print('final=',final)
print('intervalo=',intervalo)
i=inicial
L=[] #inicializamos L como una lista vacía
total=0 #inicializamos la suma a cero
while i<final:
  L.append(i) #añadimos el valor i a la lista L
  i+=intervalo #aumentamos el valor del contador
  total+=i
print(L) #imprimimos la lista
print('La suma es:',total)