Skip to content

Commit c39f4db

Browse files
authored
Merge branch 'mouredev:main' into reto-00-python
2 parents ec9a7a8 + b1ede2e commit c39f4db

File tree

22 files changed

+3055
-812
lines changed

22 files changed

+3055
-812
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//este lenguaje no tiene web oficial
2+
//comentario de una linea
3+
/*
4+
comentario de varias lineas
5+
todos los valres de bits que se ponen pueden ser variables dependiendo del compilador y arquitectura
6+
¿hey brais puedes compartir los playlists de rock que usas para tus directos?
7+
8+
este es el valor maximo que se puede representar con respecto a los bit que se maneja unsigned
9+
8 bits (1 byte) = 255
10+
16 bits (2 bytes) = 65,535
11+
32 bits (4 bytes) = 4,294,967,295
12+
64 bits (8 bytes) = 18,446,744,073,709,551,615
13+
14+
signed se puede manejar en estos rangos
15+
8 bits (1 byte) = -128 a 127
16+
16 bits (2 bytes) = -32,768 a 32,767
17+
32 bits (4 bytes) = -2,147,483,648 a 2,147,483,647
18+
64 bits (8 bytes) = -9,223,372,036,854,775,808 a 9,223,372,036,854,775,807
19+
20+
los valores de c++ son automaticamente signed
21+
22+
*/
23+
#include <iostream>
24+
#include <string>
25+
using namespace std;
26+
27+
int main() {
28+
const string constante = "C++";
29+
string variable = "¡Hola, ";
30+
31+
//hay diferentes valores numericos
32+
short corto = 65524;//este es de 16 bits
33+
int entero = 4294967294;//este es de 32 bits o 16 bits dependiendo del compilador
34+
long largo = 4294967294;//este es de 32 bits
35+
long long gigante = 18446744073709551614;//este es de 64 bits
36+
37+
float flotante = 3.141592;
38+
double doble = 3.141592653589793;
39+
long double giganteDoble = 1.000000000000001;
40+
float scientifico = 6.02E23; //el float también puede usar notación cientifica
41+
42+
//también se pueden declarar los valores sin signo
43+
unsigned short cortoSinSigno = 65535;
44+
//también está el constexpr que es un valor que se va a calcular mientras se conpila no mientras se corre
45+
constexpr float PI = 3.14159265358979323846;
46+
//y se puede usar el auto que lo detecta automatico
47+
auto autoDetectado = 3;
48+
49+
//hay diferentes valores de texto
50+
char caracter = 'a';
51+
string texto = "Hola, C++";
52+
char ascii = 65; //el char también puede ser un valor ascii
53+
54+
//y está el bool
55+
bool booleano = true;
56+
57+
cout << texto;
58+
return 0;
59+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// https://docs.oracle.com/en/java/javase/21/
2+
3+
/**
4+
* This is a javadoc comment
5+
* @author Kronstadtlambda
6+
* @version 1.0
7+
*/
8+
9+
// here define the package name
10+
// package roadmap.java.r00;
11+
12+
// here import the necessary library (optional)
13+
import java.util.Random;
14+
15+
/**
16+
* Class to show the basic sintax and others of Java programming language
17+
*/
18+
public class KronstadtLambda {
19+
/**
20+
* Main method to execute the code of this class (entry point)
21+
*/
22+
public static void main(String[] args) {
23+
24+
// Sintax to create comments:
25+
// This is a single line comment
26+
/* This is a multi-line comment
27+
* or more lines
28+
*/
29+
30+
// Sintax to manage puntuation:
31+
// ; -> end of the statement.
32+
// {} -> delimit block of code.
33+
// () -> parameters, conditions, group expressions.
34+
// [] -> declare arrays, [index] access to elements.
35+
// . -> access to methods, attributes, etc.
36+
// @ -> annotations.
37+
// :: -> method reference (functional programming).
38+
39+
// Variables and constants
40+
float variable_high;
41+
final float CONSTANT_COULUMB;
42+
variable_high = 1.7f; //meters
43+
CONSTANT_COULUMB = 8.9875517873681764e9f; // N m^2 C^-2
44+
45+
// Primitive data types
46+
byte v_byte; // Integer 8 bits
47+
short v_short; // Integer 16 bits
48+
int v_int; // Integer 32 bits
49+
long v_long; // Integer 64 bits
50+
float v_float; // Floating point 32 bits
51+
double v_double; // Floating point 64 bits
52+
char v_char; // Unicode character 16 bits
53+
boolean v_boolean; // Logical 8 bits
54+
55+
v_byte = 127;
56+
v_short = 32767;
57+
v_int = 2147483647;
58+
v_long = 9223372036854775807L;
59+
v_float = 3.4028235e38f;
60+
v_double = 1.7976931348623157e308;
61+
v_char = 'K';
62+
v_boolean = true;
63+
64+
System.out.println("A byte: " + v_byte);
65+
System.out.println("A short: " + v_short);
66+
System.out.println("An int: " + v_int);
67+
System.out.println("A long: " + v_long);
68+
System.out.println("A float: " + v_float);
69+
System.out.println("A double: " + v_double);
70+
System.out.println("A char: " + v_char);
71+
System.out.println("A boolean: " + v_boolean);
72+
73+
// Print a greeting
74+
String v_language = "Java";
75+
System.out.println("Hello, " + v_language + "!");
76+
77+
// Style guide
78+
/*
79+
* Nomenclature:
80+
* Use PascalCase for class names and interface names.
81+
* Use camelCase for method and variables names.
82+
* UPPER_CASE for constants.
83+
*
84+
* Comentary:
85+
* Use comentary to explain the code, not what the code does.
86+
*
87+
* Code organization:
88+
* Use a maximum of 80 characters per line.
89+
* Use 4 spaces to indent code and avoid using tabs.
90+
*
91+
* Declaration:
92+
* Group the declarations of variables at the beginning of the class.
93+
*/
94+
95+
} // end of the main method
96+
} // end of the class
97+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/************ 1 - SITIO OFICIAL DE JAVASCRIPT ************/
2+
3+
// Pagina que encontre muy completa de JS, con la que me saco las dudas. Me parece que no tiene una oficial. https://developer.mozilla.org/en-US/docs/Learn/JavaScript
4+
5+
/*********************************************************/
6+
7+
/************ 2 - TIPOS DE COMENTARIOS ************/
8+
9+
// Para colocar un comentario en 1 sola linea.
10+
11+
/* Para comentar
12+
en varias
13+
lineas */
14+
15+
/**************************************************/
16+
17+
/************ 3 - CREANDO VARIABLES ************/
18+
var variableVar = "Una variable usando VAR"; //Desde hace años, ya no se recomienda usar VAR
19+
let variableLet = "Una variable usando LET";
20+
const CONSTANTE = "Una constante";
21+
/***********************************************/
22+
23+
/************ 4 - TIPOS DE DATOS PRIMITIVOS ************/
24+
let tipoCadena = "Hola, soy una cadena de texto";
25+
//Los de tipo number pueden ser enteros o decimales
26+
let tipoNumber = 42;
27+
tipoNumber = 42.5;
28+
let tipoBooleano = true;
29+
let tipoIndefinido = undefined;
30+
let tipoSimbolo = Symbol("mySymbol");
31+
let tipoBigInt = 1234567890123456789012345678901234567890n;
32+
let tipoNulo = null; //Aunque algunos ejemplos lo clasifican como primitivo, en la documentación de Mozilla (https://developer.mozilla.org/es/docs/Glossary/Primitive) se indica que es un "caso especial".
33+
/*******************************************************/
34+
35+
/************ 5 - HOLA, JAVASCRIPT ************/
36+
console.log("¡Hola, JavaScript!");
37+
/**********************************************/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
/*
3+
Documentación de mozilla, altamente cualificada
4+
https://developer.mozilla.org/es/docs/Web/JavaScript
5+
6+
Documentación oficial de ECMA
7+
https://262.ecma-international.org/5.1/#sec-7
8+
*/
9+
10+
// Este es un comentario en una línea
11+
12+
/* Este es
13+
un comentario
14+
multilínea
15+
*/
16+
17+
// Variable mutable
18+
let variableModificable = 'socramdev'
19+
20+
// Variable inmutable
21+
const variableFija = 'MarcosPG'
22+
23+
// Variable tipo string
24+
const string = 'socramdev'
25+
26+
// Variable tipo number
27+
const number = 1977
28+
29+
// Variable tipo float
30+
const float = 46.75
31+
32+
// Variable tipo booleano
33+
const bool = true
34+
35+
// Otras variables no primitivas
36+
const bigInt = 1234567891011121314151617181920n
37+
const nullValor = null
38+
const simbolo = Symbol()
39+
const array = [1, 2, 3, 4, 5]
40+
const object = {
41+
name: 'Marcos',
42+
age: 46,
43+
city: 'Sevilla',
44+
country: 'España'
45+
}
46+
47+
console.log('Hola, JavaScript')
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# URL oficial de Python: https://www.python.org/
3+
4+
# Diferentes formas de crear comentarios en Python
5+
# ------------------------------------------------
6+
7+
# Esto es un Comentario in-line
8+
9+
# Python no permite de manera nativa comentarios multilínea
10+
# por lo que podmeos "simular" esta característica enlazando
11+
# diversos comentario in-line
12+
13+
'''
14+
O bien, utilizando la sintaxis de cadenas multilíneas
15+
con triple comilla simple o triple comilla doble
16+
'''
17+
18+
# Creación de una variable y una constante
19+
# ------------------------------------
20+
saludo = "Hola Mouredev"
21+
22+
# Para crear una constante declaramos igualmente una variable,
23+
# y utilizamos la convención de designar el identificador en mayúsculas
24+
# para que otros programadores sepan que ese variable no debe ser alterada
25+
CTE = 3.14
26+
27+
# Representación de datos primitivos mediante variables
28+
# -----------------------------------------------------
29+
int_entero = 66 # Número enteros
30+
float_decimal = 3.14
31+
str_texto = "Hola Mouredev"
32+
bool_booleano = True # Se le pueden asignar dos valores True o False
33+
complex_complejo = 4.5 + 6j # a + b numeros reales y j unidad imaginaria
34+
35+
# Imprimir por terminal
36+
# ---------------------
37+
print ("¡Hola, Python!")
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Asignación de variables por VALOR
2+
a = 5
3+
b = a
4+
b = 10
5+
print(a)
6+
print(b)
7+
8+
# Asignación de un flotante
9+
x = 3.14
10+
y = x # y ahora es una copia de x
11+
12+
# Modificando y no afecta a x
13+
y = 2.71
14+
print(x) # Output: 3.14
15+
print(y) # Output: 2.71
16+
17+
# Asignación de una cadena de caracteres
18+
s1 = "Hola"
19+
s2 = s1 # s2 ahora es una copia de s1
20+
21+
# Modificando s2 no afecta a s1
22+
s2 = "Adiós"
23+
print(s1) # Output: Hola
24+
print(s2) # Output: Adiós
25+
26+
27+
# Asignación de una tupla
28+
t1 = (1, 2, 3)
29+
t2 = t1 # t2 ahora es una copia de t1
30+
31+
# Modificando t2 no afecta a t1
32+
t2 = (4, 5, 6)
33+
print(t1) # Output: (1, 2, 3)
34+
print(t2) # Output: (4, 5, 6)
35+
36+
# Asignación de variables por REFERENCIA
37+
38+
# Listas
39+
# Asignación de una lista
40+
list1 = [1, 2, 3]
41+
list2 = list1 # list2 se refiere a la misma lista que list1
42+
43+
# Modificando list2 también afecta a list1
44+
list2.append(4)
45+
print(list1) # Output: [1, 2, 3, 4]
46+
print(list2) # Output: [1, 2, 3, 4]
47+
48+
# Asignación de un diccionario
49+
dict1 = {'a': 1, 'b': 2}
50+
dict2 = dict1 # dict2 se refiere al mismo diccionario que dict1
51+
52+
# Modificando dict2 también afecta a dict1
53+
dict2['c'] = 3
54+
print(dict1) # Output: {'a': 1, 'b': 2, 'c': 3}
55+
print(dict2) # Output: {'a': 1, 'b': 2, 'c': 3}
56+
57+
# Asignación de un conjunto
58+
set1 = {1, 2, 3}
59+
set2 = set1 # set2 se refiere al mismo conjunto que set1
60+
61+
# Modificando set2 también afecta a set1
62+
set2.add(4)
63+
print(set1) # Output: {1, 2, 3, 4}
64+
print(set2) # Output: {1, 2, 3, 4}
65+
66+
67+
# DIFICULTAD EXTRA
68+
# VALOR
69+
def intercambia_valor(param_1, param_2):
70+
return param_2, param_1
71+
72+
param_1 = input("Introduce primer parametro: ")
73+
param_2 = input("Introduce segundo parametro: ")
74+
75+
nuevo_param_1 , nuevo_param_2 = intercambia_valor(param_1,param_2)
76+
print(f"Variables originales param_1 = {param_1}")
77+
print(f"Variables originales param_2 = {param_2}")
78+
print(f"Variables nuevo_param_1 = {nuevo_param_1}")
79+
print(f"Variables nuevo_param_2 = {nuevo_param_2}")
80+
81+
# REFERENCIA
82+
lista_1 = [1,2,3]
83+
lista_2 = [4,5,6]
84+
85+
def intercambia_referencia(val_1, val_2):
86+
val_1 = val_2
87+
val_2 = val_1
88+
return val_1, val_2
89+
90+
nueva_lista_1, nueva_lista_2 = intercambia_referencia(lista_1,lista_2)
91+
92+
print(f"Variables originales lista_1 = {lista_1}")
93+
print(f"Variables originales lista_2 = {lista_2}")
94+
print(f"Variables nueva_lista_1 = {nueva_lista_1}")
95+
print(f"Variables nueva_lista_2 = {nueva_lista_2}")

0 commit comments

Comments
 (0)