You've already forked Curso-lenguaje-python
Update Python Ofensivo
This commit is contained in:
19
python-ofensivo/00_ejercicios/05_encapsulamiento04.py
Normal file
19
python-ofensivo/00_ejercicios/05_encapsulamiento04.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
class Caja:
|
||||
|
||||
def __init__(self, *items):
|
||||
self.items = items
|
||||
|
||||
def __str__(self):
|
||||
|
||||
print("Se ha creado una caja con las siguientes frutas: ")
|
||||
|
||||
for item in self.items:
|
||||
print(item)
|
||||
|
||||
|
||||
caja = Caja("Manzana", "Pera", "Naranja", "Platano")
|
||||
Reference in New Issue
Block a user