mirror of https://github.com/JavMB/ejercicios
Fix formatting and improve greeting function in prueba.py
This commit is contained in:
parent
4e031680ba
commit
ed481d9b15
|
|
@ -1,7 +1,7 @@
|
||||||
# =====================================
|
# =====================================
|
||||||
# VARIABLES Y TIPOS (No se declara tipo explícito)
|
# VARIABLES Y TIPOS (No se declara tipo explícito)
|
||||||
# =====================================
|
# =====================================
|
||||||
nombre = "Javi"
|
nombre = "Javi"
|
||||||
edad = 22
|
edad = 22
|
||||||
pi = 3.14
|
pi = 3.14
|
||||||
activo = True
|
activo = True
|
||||||
|
|
@ -38,6 +38,7 @@ while contador < 3:
|
||||||
def saludar(nombre):
|
def saludar(nombre):
|
||||||
return f"Hola {nombre}!"
|
return f"Hola {nombre}!"
|
||||||
|
|
||||||
|
|
||||||
print(saludar("Mundo"))
|
print(saludar("Mundo"))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,6 +65,6 @@ class Persona:
|
||||||
def saludar(self):
|
def saludar(self):
|
||||||
print(f"Soy {self.nombre} y tengo {self.edad} años.")
|
print(f"Soy {self.nombre} y tengo {self.edad} años.")
|
||||||
|
|
||||||
|
|
||||||
p1 = Persona("Javi", 22)
|
p1 = Persona("Javi", 22)
|
||||||
p1.saludar()
|
p1.saludar()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue