Skip to content

Commit 8795fa6

Browse files
authored
Merge pull request mouredev#3774 from Kcx46/main
#[00] - [Python]
2 parents 8f8d8a7 + 060716b commit 8795fa6

File tree

2 files changed

+101
-0
lines changed
  • Roadmap
    • 00 - SINTAXIS, VARIABLES, TIPOS DE DATOS Y HOLA MUNDO/python
    • 01 - OPERADORES Y ESTRUCTURAS DE CONTROL/python

2 files changed

+101
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#Este es el sitio oficial del programa#
2+
#https://www.python.org/
3+
#La sintaxis para crear un comentario es con el simbolo de numeral (#)
4+
'''
5+
O se pueden crear comentarios
6+
multinlinea con tres comillas al inci
7+
y al final del comentario
8+
'''
9+
10+
this_is_a_variable = 1
11+
there_is_no_constants_in_python = 2
12+
this_is_a_string = "Hello World"
13+
this_is_a_number = 3
14+
this_is_also_a_number = 3.14
15+
this_is_a_boolean = True
16+
this_is_a_list = [1, 2, 3, "Paco", True, ["Perro, Gato, Pajaro"]]
17+
this_is_also_a_list = list([1,2,3,4,5,6,7,8,9,10])
18+
this_is_a_tuple = (1, 2, 3, 4, 5)
19+
this_is_also_a_tuple = tuple((1, 2, 3, 4, 5))
20+
this_is_a_set = {1,2,3,3,4,5,5}
21+
this_is_also_a_set = set([1,2,3,4,5,6,7,8,9,10,10,10,10,10])
22+
this_is_a_dict = {"name": "Paco", "age": 25, "city": "CDMX"}
23+
this_is_also_a_dict = dict(name="Paco", age=25, city="CDMX")
24+
25+
print("***Hola Python***")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#Operadores y estructuras de control#
2+
3+
#operadores aritmeticos
4+
suma = 5 + 5
5+
resta = 5 - 5
6+
multiplicacion = 5 * 5
7+
division = 5 / 5
8+
division_entera = 5 // 5
9+
modulo = 5 % 5
10+
potencia = 5 ** 5
11+
#operadores logicos
12+
and_op = True and False
13+
or_op = True or False
14+
also_or_op = True | False
15+
not_op = not True
16+
#operadores de comparacion
17+
igual = 5 == 5
18+
diferente = 5 != 5
19+
mayor_que = 5 > 5
20+
menor_que = 5 < 5
21+
mayor_o_igual_que = 5 >= 5
22+
menor_o_igual_que = 5 <= 5
23+
#printeos
24+
print(f"5 + 5 = {suma}", "\n")
25+
print(f"5 - 5 = {resta}", "\n")
26+
print(f"5 * 5 = {multiplicacion}", "\n")
27+
print(f"5 / 5 = {division}", "\n")
28+
print(f"5 // 5 = {division_entera}", "\n")
29+
print(f"5 % 5 = {modulo}", "\n")
30+
print(f"5 ** 5 = {potencia}", "\n")
31+
print(f"True and False = {and_op}", "\n")
32+
print(f"True or False = {or_op}", "\n")
33+
print(f"True | False = {also_or_op}", "\n")
34+
print(f"not True = {not_op}", "\n")
35+
print(f"5 == 5 es {igual}", "\n")
36+
print(f"5 != 5 es {diferente}", "\n")
37+
print(f"5 > 5 es {mayor_que}", "\n")
38+
print(f"5 < 5 es {menor_que}", "\n")
39+
print(f"5 >= 5 es {mayor_o_igual_que}", "\n")
40+
print(f"5 <= 5 es {menor_o_igual_que}", "\n")
41+
print("*"*50)
42+
#estructuras de control
43+
print("**ESTRUCTURAS DE CONTROL**")
44+
print("if sum == 10 print sum \n")
45+
if suma == 10:
46+
print("La suma es igual a 10")
47+
else:
48+
print("La suma no es igual a 10")
49+
if resta == 0:
50+
print("La resta es igual a 0")
51+
elif resta < 0:
52+
print("La resta es menor a 0")
53+
else:
54+
print("La resta es mayor a 0")
55+
print("\n")
56+
57+
list_for_for = [1, 2, 3, 4, 5]
58+
print("**FOR**")
59+
for i in list_for_for:
60+
print(i)
61+
print("\n")
62+
print("**WHILE**")
63+
while suma < 20:
64+
print(suma)
65+
suma += 1
66+
print("\n")
67+
print("*"*50)
68+
print("***EJERCICIO EXTRA***")
69+
#Dificultad extra
70+
'''
71+
Este imprime por consola todos los números comprendidos
72+
entre 10 y 55 (incluidos), pares, y que no son ni el 16 ni múltiplos de 3.
73+
'''
74+
for i in range(10, 57):
75+
if i % 2 == 0 and i != 16 and 1 % 3 != 0:
76+
print(i)

0 commit comments

Comments
 (0)