Skip to content
Snippets Groups Projects
Commit e8058cc5 authored by Alvaro Andres Ortega Rojas's avatar Alvaro Andres Ortega Rojas
Browse files

Delete Clase_while__1_.ipynb

parent 30d203a5
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:23a51995-b299-4b76-bbb4-fb3105160f71 tags:
``` python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
```
%% Cell type:code id:5f974c56-ba44-466f-8985-60440508020b tags:
``` python
A = [i**2+i/2 for i in range(0,10,1)]
```
%% Cell type:code id:874431e7-40b8-47a5-ad90-998b7fbe4783 tags:
``` python
print (A)
```
%% Output
[0.0, 1.5, 5.0, 10.5, 18.0, 27.5, 39.0, 52.5, 68.0, 85.5]
%% Cell type:code id:585e1ea2-7024-44d9-9bcb-25aba369b08c tags:
``` python
AA=[1,5,1,6,7]
```
%% Cell type:code id:bf795507-9db7-4248-992e-4aebc6193555 tags:
``` python
suma=0
i=0
while suma<=10:
suma=suma+AA[i]
i=i+1
```
%% Cell type:code id:fb75a135-f72f-4e1b-9526-bd852ce40e7c tags:
``` python
print(suma)
```
%% Output
13
%% Cell type:code id:80490c1b-0b94-4bb7-864d-8a1d7a795513 tags:
``` python
while i<=(len(AA)-1):
suma+=AA[i]
i+=1
```
%% Cell type:code id:a136253f-ae77-471e-b5fb-53970fc7727e tags:
``` python
print(i+suma)
```
%% Output
25
%% Cell type:code id:1f4e03cf-f9e9-4f0e-bdff-880acd114985 tags:
``` python
suma=0
i=0
while i<=(len(AA)-1):
suma+=AA[i]
i+=1
if i==4:
break
print(suma)
```
%% Output
13
%% Cell type:code id:ab693934-1a36-41f7-80a9-e3e222b2c66d tags:
``` python
suma = 0
i = 0
B = [1,6,8,10,12,25,13,8]
while i<=(len(B)-1):
suma+=B[i]
if suma > 45:
break
i+=1
print(i-1)
print(B[i-1])
```
%% Output
4
12
%% Cell type:code id:35627de2-1f82-4ff7-8c19-82c7559aa77d tags:
``` python
def my_print (string):
string=("hola")
print(string)
```
%% Cell type:code id:327bd84e-0040-400c-9032-cb90b3873af9 tags:
``` python
def my_primos(primos):
primos=()
lista = int(input('¿Hasta qué número quieres la lista?: '))
cont = 0
for i in range(2, lista + 1):
primos = True
for j in range(2,i):
if i == j:
break
elif i%j == 0:
primos = False
else:
continue
if primos == True:
print(' ',i, end='')
cont += 1
print('\nHay %u números primos.' % cont )
Terminar('Eso es una guía, no voy a usar ese mismo')
```
%% Output
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-96-c2ad63ad9687> in <module>
3 lista = int(input('¿Hasta qué número quieres la lista?: '))
4 cont = 0
----> 5 for i in range(2, lista + 1):
6 primos = True
7 for j in range(2,i):
NameError: name 'lista' is not defined
%% Cell type:code id:aebfa0fd-a52a-4823-8c60-c53e30f34d4e tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment