Update Python Ofensivo

This commit is contained in:
2023-12-25 21:16:48 +01:00
parent ab95e6f805
commit 490afce41f
8 changed files with 196 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""
Métodos especiales
"""
class Pizza:
def __init__(self, size, *toppings):
self.size = size
self.toppings = toppings
def description(self):
print(
f"""
Esta pizza es de {self.size} cm
y tiene los siguientes ingredientes:""")
for topping in self.toppings:
print(f"- {topping}")
pizza = Pizza(12, "Chorizo", "Queso", "Jamon", "Cebolla")
pizza.description()