Skip to content

Commit f96c320

Browse files
committed
Merge branch 'main' of github.com:mouredev/roadmap-retos-programacion
2 parents bdec728 + f42636a commit f96c320

File tree

45 files changed

+4757
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4757
-933
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
3+
namespace RetosDeProgramacion
4+
{
5+
//URL oficial de C#: https://learn.microsoft.com/es-es/collections/yz26f8y64n7k07
6+
//comentario de una sola linea
7+
/*
8+
* comentario de multiples lineas
9+
*/
10+
11+
internal class Program
12+
{
13+
//creando variable global
14+
15+
int edad = 30;
16+
17+
//Creando variable tipo constante
18+
19+
const int numero = 1;
20+
static void Main(string[] args)
21+
{
22+
byte myByte = 100;
23+
Console.WriteLine($"esto es un byte {myByte}");
24+
sbyte myByte2 = -10;
25+
Console.WriteLine($"esto es un sbyte {myByte2}");
26+
short myShort = 20000;
27+
Console.WriteLine($"esto es un short {myShort}");
28+
ushort myUShort = 60000;
29+
Console.WriteLine($"esto es un Ushort {myUShort}");
30+
int myInt = -2000000000;
31+
Console.WriteLine($"esto es un Int {myInt}");
32+
uint myUint = 2000000000;
33+
Console.WriteLine($"esto es un Uint {myUint}");
34+
long myLong = -1000000000000000000;
35+
Console.WriteLine($"esto es un Long {myLong}");
36+
ulong myULong = 1000000000000000000;
37+
Console.WriteLine($"esto es un ULong {myULong}");
38+
float myFloat = 1.3f;
39+
Console.WriteLine($"esto es un float {myFloat}");
40+
double myDouble = 10.2;
41+
Console.WriteLine($"esto es un double {myDouble}");
42+
String myString = "Ejemplo de String";
43+
Console.WriteLine($"esto es un String {myString}");
44+
bool myBool = false;
45+
Console.WriteLine($"esto es un boolean {myBool}");
46+
47+
Console.WriteLine("Hola, C#!");
48+
Console.ReadKey();
49+
}
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// https://kotlinlang.org/
2+
3+
// Comentario en una sola linea
4+
/* Comentario en
5+
* multiples lineas
6+
*/
7+
8+
// val -> variable de solo lectura, no puede cambiar de valor
9+
// var -> variable mutable, que puede cambiar de valor
10+
val x = 5
11+
var y = 8
12+
13+
// Los datos primitivos/básicos son
14+
//
15+
// Enteros -> Byte, Short, Int, Long
16+
// Enteros sin signo -> UByte, UShort, UInt, ULong
17+
// Números con decimal -> Float, Double
18+
// Booleanos -> Boolean
19+
// Caracteres -> Char
20+
// Cadenas de texto -> String
21+
22+
val entero: Int = 843
23+
val text = "Hola comunidad"
24+
val decimal: Double = 3.141592
25+
val largeNumber: Long = 48_365_102_000
26+
val aprendiendo = true
27+
28+
fun main() {
29+
print("¡Hola, Kotlin!")
30+
}
31+
32+
// NOTAS FINALES
33+
//
34+
// 1) Se recomienda utilizar var solamente cuando sea necesario.
35+
// 2) Los tipos de dato pueden ser inferidos al momento de la asignación o definirse después
36+
// del nombre de la variable con : (dos puntos) y el tipo de dato.
37+
// 3) Para los números se pueden colocar _ (guion bajo) para mejorar la lectura
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,23 @@
1+
# Pagina Oficial de Phyton = https://www.python.org/
2+
3+
#Comentario de una linea en phyton
4+
"""
5+
Comentario en varias
6+
lineas
7+
"""
8+
9+
my_variable= "mi variable"
10+
11+
MY_CONSTANT = " MI CONSTANTE"
12+
13+
int= 0
14+
int= -16
15+
int= 6
16+
17+
float= 3,14
18+
bool= true
19+
bool= false
20+
21+
string= "mi comentario"
22+
23+
print("¡hola,Phyton!")
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)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
"""
2+
* Operadores
3+
"""
4+
5+
# Aritmeticos
6+
7+
print(f"Addition: 18 + 8 = {18 + 8}")
8+
print(f"Subtraction: 18 - 8 = {18 - 8}")
9+
print(f"Multiplication: 18 * 8 = {18 * 8}")
10+
print(f"Division: 18 / 8 = {18 / 8}")
11+
print(f"Modulus: 18 % 8 = {18 % 8}")
12+
print(f"Floor division: 18 // 8 = {18 // 8}")
13+
print(f"Exponentiation: 18 ** 8 = {18 ** 8}")
14+
15+
# Logicos (and or not)
16+
17+
print(True == True and False == False)
18+
print(False == True or False == False)
19+
print(not True)
20+
21+
# Comparacion
22+
23+
print(f"Greater than: 24 > 24 = {24 > 24}")
24+
print(f"Less than: 24 < 24 = {24 < 24}")
25+
print(f"Greater than or equal to: 24 >= 24 = {24 >= 24}")
26+
print(f"Less than or equal to: 24 <= 24 = {24 <= 24}")
27+
print(f"Equal: 24 == 24 = {24 == 24}")
28+
print(f"Not equal: 24 != 24 = {24 != 24}")
29+
30+
# Asignacion
31+
32+
number = 24
33+
34+
number += 2
35+
print(number)
36+
number -= 3
37+
print(number)
38+
number *= 1
39+
print(number)
40+
number /= 5
41+
print(number)
42+
number %= 5
43+
print(number)
44+
number //= 1
45+
print(number)
46+
number **= 4
47+
print(number)
48+
49+
# Identidad
50+
51+
variable = None
52+
53+
print(f"My variable is None: {variable is None}")
54+
print(f"My variable is not None: {variable is not None}")
55+
56+
# Pertenencia
57+
58+
print(f"'E' in word: {"E" in "word"}")
59+
print(f"'E' not in word: {"E" not in "word"}")
60+
61+
# Bits
62+
63+
a = 8 # 1000
64+
b = 10 # 1010
65+
66+
print(f"AND: 8 & 10 = {8 & 10}") # 0001 <
67+
print(f"OR: 8 | 10 = {8 | 10}") # 0101 <
68+
print(f"XOR: 8 ^ 10 = {8 ^ 10}") # 0100 <
69+
print(f"NOT: ~8 = {~8}")
70+
print(f"Right shift: 8 >> 10: {8 >> 2}") # 0010
71+
print(f"Left shift: 8 << 10: {8 << 2}") # 100000
72+
73+
"""
74+
* Estructuras de control
75+
"""
76+
77+
# Condicionales
78+
79+
language = "Python"
80+
81+
if language == "JavaScript":
82+
print("The language is JavaScript")
83+
elif language == "Python":
84+
print("The language is Python")
85+
else:
86+
print("It could be another language")
87+
88+
# Iterativas
89+
90+
for number in range(1, 9):
91+
print(number)
92+
93+
age = 0
94+
95+
while age <= 8:
96+
print(age)
97+
age += 2
98+
99+
# Excepciones
100+
101+
try:
102+
print(18 / 0)
103+
except:
104+
print("Division by zero?") # ZeroDivisionError
105+
finally:
106+
print("Bye!")
107+
108+
"""
109+
* Extra
110+
"""
111+
112+
for extra_number in range(10, 56):
113+
if extra_number %2 == 0 and extra_number != 16 and extra_number %3 != 0:
114+
print(extra_number)

0 commit comments

Comments
 (0)