Skip to content

Commit 8c40213

Browse files
authored
Merge pull request mouredev#6166 from NicoHeguaburu/reto-01
#1-python
2 parents 9f23be1 + 946ba8b commit 8c40213

File tree

2 files changed

+184
-0
lines changed

2 files changed

+184
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# https://python.org/
2+
3+
# Comentario de una linea
4+
5+
"""
6+
Comentario en
7+
varias lineas
8+
"""
9+
10+
'''
11+
Otra opccion de
12+
comentario en varias
13+
lineas
14+
'''
15+
16+
variable = "Mi variable"
17+
18+
CONSTANTE = "Mi constante"
19+
20+
entero = 1
21+
decimal = 1,2
22+
booleano = False
23+
texto = "Mi texto"
24+
25+
print("Hola Python")
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
2+
3+
4+
#aritmeticos
5+
x = 3
6+
y = 6
7+
8+
suma = x + y
9+
print (suma)
10+
11+
resta = x - y
12+
print (resta)
13+
14+
dividir = x / y
15+
print (dividir)
16+
17+
multiplicar = x * y
18+
print (resta)
19+
20+
dividir_enteros = x // y
21+
print(dividir_enteros)
22+
23+
exponente = x ** y
24+
print(exponente)
25+
26+
resto = x % y
27+
print(resto)
28+
29+
30+
#logicos
31+
#and
32+
print (True and True)
33+
print (False and False)
34+
print (True and False)
35+
print (False and True)
36+
37+
38+
#or
39+
print (True or True)
40+
print (False or False)
41+
print (True or False)
42+
print (False or True)
43+
44+
45+
#not
46+
print (not True)
47+
print (not False)
48+
49+
50+
#comparacion
51+
igual = 5 == 5
52+
print(igual)
53+
54+
diferente = 5 != 5
55+
print(diferente)
56+
57+
mayor = 5 > 3
58+
print(mayor)
59+
60+
menor = 5 < 9
61+
print(menor)
62+
63+
mayor_igual = 5 >= 5
64+
print(mayor_igual)
65+
66+
menor_igual = 5<= 1
67+
print(menor_igual)
68+
69+
70+
#asignacion
71+
72+
#simple
73+
z = 3
74+
print(z)
75+
76+
#suma
77+
z += 4
78+
print(z)
79+
80+
#resta
81+
z -= 8
82+
print(z)
83+
84+
z *= 2
85+
print(z)
86+
87+
z /= 2
88+
print(z)
89+
90+
#identidad
91+
a = 25
92+
b = 2
93+
94+
print(a is b)
95+
print(a is not b)
96+
97+
98+
#pertenecia
99+
print("n" in "nicolás")
100+
print("x" in "nicolás")
101+
102+
print("n" not in "nicolás")
103+
print("x" not in "nicolás")
104+
105+
#bits
106+
x = 5 # 5 = 101 en bit
107+
y = 3 # 3 = 011 en bit
108+
109+
print(x & y) #AND bit a bit
110+
print(x | y) #OR bit a bit
111+
print(x ^ y) #XOR bit a bit
112+
print(~ x) #NOT bit a bit
113+
print(x << 1) #dezplazar a la izq en bit
114+
print(x >> 1) #dezplazar a la der en bit
115+
116+
117+
118+
119+
120+
#ESTRUCTURAS DE CONTROL
121+
122+
#condicionales
123+
x = 10
124+
y = 20
125+
if x > y:
126+
print("X ES MAYOR A Y")
127+
elif x == y:
128+
print("X ES IGUAL A Y")
129+
else:
130+
print("X ES MENOR A Y")
131+
132+
133+
#iteraciones
134+
for i in range(11):
135+
print(i)
136+
137+
y = 8
138+
while y <= 10:
139+
print(y)
140+
y += 1
141+
142+
143+
#excepciones
144+
try:
145+
print(10 / 10)
146+
except:
147+
print("hay un error")
148+
finally:
149+
print("se a completado la operacion")
150+
151+
152+
#DIFICULTAD EXTRA
153+
i = 10
154+
while i <= 55:
155+
if i % 2 == 0 and i != 16 and i % 3 != 0:
156+
print (i)
157+
i += 1
158+
else:
159+
i += 1

0 commit comments

Comments
 (0)