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

Skip to content

Commit 2cebaf9

Browse files
committed
Día 6
1 parent b89bc64 commit 2cebaf9

File tree

4 files changed

+104
-2
lines changed

4 files changed

+104
-2
lines changed

09_loops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Clase 5 (31/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1578036618
2+
13
### Loops ###
24

35
# While

10_functions.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Clase 6 (08/09/22) en directo desde Twitch: https://www.twitch.tv/videos/1585369113
2+
3+
### Functions ###
4+
5+
# Definición
6+
7+
def my_function ():
8+
print("Esto es una función")
9+
10+
my_function()
11+
my_function()
12+
my_function()
13+
14+
# Función con parámetros de entrada/argumentos
15+
16+
def sum_two_values (first_value: int, second_value):
17+
print(first_value + second_value)
18+
19+
sum_two_values(5, 7)
20+
sum_two_values(54754, 71231)
21+
sum_two_values("5", "7")
22+
sum_two_values(1.4, 5.2)
23+
24+
# Función con parámetros de entrada/argumentos y retorno
25+
26+
def sum_two_values_with_return (first_value, second_value):
27+
my_sum = first_value + second_value
28+
return my_sum
29+
30+
my_result = sum_two_values(1.4, 5.2)
31+
print(my_result)
32+
33+
my_result = sum_two_values_with_return(10, 5)
34+
print(my_result)
35+
36+
# Función con parámetros de entrada/argumentos por clave
37+
38+
def print_name (name, surname):
39+
print(f"{name} {surname}")
40+
41+
print_name(surname = "Moure", name = "Brais")
42+
43+
# Función con parámetros de entrada/argumentos por defecto
44+
45+
def print_name_with_default (name, surname, alias = "Sin alias"):
46+
print(f"{name} {surname} {alias}")
47+
48+
print_name_with_default("Brais", "Moure")
49+
print_name_with_default("Brais", "Moure", "MoureDev")
50+
51+
# Función con parámetros de entrada/argumentos arbitrarios
52+
53+
def print_upper_texts(*texts):
54+
print(type(texts))
55+
for text in texts:
56+
print(text.upper())
57+
58+
59+
print_upper_texts("Hola", "Python", "MoureDev")
60+
print_upper_texts("Hola")

11_classes.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Clase 6 (08/09/22) en directo desde Twitch: https://www.twitch.tv/videos/1585369113
2+
3+
### Classes ###
4+
5+
# Definición
6+
7+
class MyEmptyPerson:
8+
pass # Para poder dejar la clase vacía
9+
10+
print(MyEmptyPerson)
11+
print(MyEmptyPerson())
12+
13+
# Clase con constructor, funciones y popiedades privadas y públicas
14+
15+
class Person:
16+
def __init__ (self, name, surname, alias = "Sin alias"):
17+
self.full_name = f"{name} {surname} ({alias})" # Propiedad pública
18+
self.__name = name # Propiedad privada
19+
20+
def get_name (self):
21+
return self.__name
22+
23+
def walk (self):
24+
print(f"{self.full_name} está caminando")
25+
26+
my_person = Person("Brais", "Moure")
27+
print(my_person.full_name)
28+
print(my_person.get_name())
29+
my_person.walk()
30+
31+
my_other_person = Person("Brais", "Moure", "MoureDev")
32+
print(my_other_person.full_name)
33+
my_other_person.walk()
34+
my_other_person.full_name = "Héctor de León (El loco de los perros)"
35+
print(my_other_person.full_name)
36+
37+
my_other_person.full_name = 666
38+
print(my_other_person.full_name)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
##### Si consideras útil esta actividad, apóyala haciendo "★ Star" en el repositorio. ¡Gracias!
99

1010
> ---
11-
> **🔴 PRÓXIMA CLASE: Jueves 8 de Agosto a las 18:00 (hora España)**
11+
> **🔴 PRÓXIMA CLASE: Jueves 15 de Agosto a las 20:00 (hora España)**
1212
>
13-
> En [Discord](https://discord.gg/U3KjjfUfUJ?event=1014784271455625236) tienes creado un [evento](https://discord.gg/U3KjjfUfUJ?event=1014784271455625236) para que consultes la hora de tu país y añadas un recordatorio.
13+
> En [Discord](https://discord.gg/CY7zTpbQ?event=1017723765368553562) tienes creado un [evento](https://discord.gg/CY7zTpbQ?event=1017723765368553562) para que consultes la hora de tu país y añadas un recordatorio.
1414
>
1515
> *Finalizada la clase, se actualizará el repositorio con los nuevos recursos*
1616
>
@@ -27,6 +27,8 @@
2727
* Sets y diccionarios.
2828
* Clase 5 (31/08/22): [Vídeo en Twitch con la clase completa](https://www.twitch.tv/videos/1578036618)
2929
* Condicionales y bucles.
30+
* Clase 6 (08/09/22): [Vídeo en Twitch con la clase completa](https://www.twitch.tv/videos/1585369113)
31+
* Funciones y clases.
3032

3133
---
3234

0 commit comments

Comments
 (0)