Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 847470c

Browse files
committed
Día 2
1 parent f4109d6 commit 847470c

File tree

5 files changed

+126
-4
lines changed

5 files changed

+126
-4
lines changed

00_helloworld.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# Clase 1 (03/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1551265068
2+
13
### Hola Mundo ###
2-
# Clase en directo desde Twitch: https://www.twitch.tv/videos/1551265068
34

45
# Nuestro hola mundo en Python
56
print("Hola Python")

01_variables.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# Clase 1 (03/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1551265068
2+
13
### Variables ###
2-
# Clase en directo desde Twitch: https://www.twitch.tv/videos/1551265068
34

45
my_string_variable = "My String variable"
56
print(my_string_variable)

02_operators.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Clase 2 (10/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1558018826
2+
3+
### Operadores Aritméticos ###
4+
5+
# Operaciones con enteros
6+
print(3 + 4)
7+
print(3 - 4)
8+
print(3 * 4)
9+
print(3 / 4)
10+
print(10 % 3)
11+
print(10 // 3)
12+
print(2 ** 3)
13+
print(2 ** 3 + 3 - 7 / 1 // 4)
14+
15+
# Operaciones con cadenas de texto
16+
print("Hola " + "Python " + "¿Qué tal?")
17+
print("Hola " + str(5))
18+
19+
# Operaciones mixtas
20+
print("Hola " * 5)
21+
print("Hola " * (2 ** 3))
22+
23+
my_float = 2.5 * 2
24+
print("Hola " * int(my_float))
25+
26+
### Operadores Comparativos ###
27+
28+
# Operaciones con enteros
29+
print(3 > 4)
30+
print(3 < 4)
31+
print(3 >= 4)
32+
print(4 <= 4)
33+
print(3 == 4)
34+
print(3 != 4)
35+
36+
# Operaciones con cadenas de texto
37+
print("Hola" > "Python")
38+
print("Hola" < "Python")
39+
print("aaaa" >= "abaa") # Ordenación alfabética por ASCII
40+
print(len("aaaa") >= len("abaa")) # Cuenta caracteres
41+
print("Hola" <= "Python")
42+
print("Hola" == "Hola")
43+
print("Hola" != "Python")
44+
45+
### Operadores Lógicos ###
46+
47+
# Basada en el Álgebra de Boole https://es.wikipedia.org/wiki/%C3%81lgebra_de_Boole
48+
print(3 > 4 and "Hola" > "Python")
49+
print(3 > 4 or "Hola" > "Python")
50+
print(3 < 4 and "Hola" < "Python")
51+
print(3 < 4 or "Hola" > "Python")
52+
print(3 < 4 or ("Hola" > "Python" and 4 == 4))
53+
print(not(3 > 4))

03_strings.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Clase 2 (10/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1558018826
2+
3+
### Strings ###
4+
5+
my_string = "Mi String"
6+
my_other_string = 'Mi otro String'
7+
8+
print(len(my_string))
9+
print(len(my_other_string))
10+
print(my_string + " " + my_other_string)
11+
12+
my_new_line_string = "Este es un String\ncon salto de línea"
13+
print(my_new_line_string)
14+
15+
my_tab_string = "\tEste es un String con tabulación"
16+
print(my_tab_string)
17+
18+
my_scape_string = "\\tEste es un String \\n escapado"
19+
print(my_scape_string)
20+
21+
# Formateo
22+
23+
name, surname, age = "Brais", "Moure", 35
24+
print("Mi nombre es {} {} y mi edad es {}".format(name, surname, age))
25+
print("Mi nombre es %s %s y mi edad es %d" %(name, surname, age))
26+
print("Mi nombre es " + name + " " + surname + " y mi edad es " + str(age))
27+
print(f"Mi nombre es {name} {surname} y mi edad es {age}")
28+
29+
# Desempaqueado de caracteres
30+
31+
language = "python"
32+
a, b, c, d, e, f = language
33+
print(a)
34+
print(e)
35+
36+
# División
37+
38+
language_slice = language[1:3]
39+
print(language_slice)
40+
41+
language_slice = language[1:]
42+
print(language_slice)
43+
44+
language_slice = language[-2]
45+
print(language_slice)
46+
47+
language_slice = language[0:6:2]
48+
print(language_slice)
49+
50+
# Reverse
51+
52+
reversed_language = language[::-1]
53+
print(reversed_language)
54+
55+
# Funciones del lenguaje
56+
57+
print(language.capitalize())
58+
print(language.upper())
59+
print(language.count("t"))
60+
print(language.isnumeric())
61+
print("1".isnumeric())
62+
print(language.lower())
63+
print(language.lower().isupper())
64+
print(language.startswith("Py"))
65+
print("Py" == "py") # No es lo mismo

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
### Clases en vídeo
1313
* Clase 1 (03/08/22): [Vídeo en Twitch con la clase completa](https://www.twitch.tv/videos/1551265068)
1414
* Contexto, instalación, configuración, hola mundo y variables.
15-
* **🔴 PRÓXIMA CLASE: Miércoles 10 de Agosto a las 20:00 (hora España)**
16-
* En [Discord](https://discord.gg/mouredev) tienes creado un evento para que consultes la hora de tu país.
15+
* Clase 2 (10/08/22): [Vídeo en Twitch con la clase completa](https://www.twitch.tv/videos/1558018826)
16+
* Operadores y Strings.
17+
* **🔴 PRÓXIMA CLASE: Miércoles 17 de Agosto a las 20:00 (hora España)**
18+
* En [Discord](https://discord.gg/PkpmuVcx?event=1007285935941099600) tienes creado un evento para que consultes la hora de tu país y añadas un recordatorio.
1719

1820
---
1921

0 commit comments

Comments
 (0)