This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------+ +-----------------+ | |
| FABRICANTES | | ARTICULOS | | |
+----------------+ 1..1 +-----------------+ | |
| id: int (pKey) |-------+ | id: int (pKey) | | |
| nombre: Text | | | nombre: Text | | |
+----------------+ | | precio: Real | | |
+------| fabricante: int | | |
0..n +-----------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
characters = [Jedi('Anakin', 10000), Jedi('Yoda', 1000000), StarWarsCharacter('Chewie')] | |
sum = 0 | |
for elt in characters: | |
sum = sum + elt.midichlorians |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anakin = Jedi('Anakin', 100000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chewie = StarWarsCharacter('Chewbacca') | |
m = chewie.midichlorians |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Jerarquía de clases para representar personajes de Star Wars | |
class StarWarsCharacter: | |
def __init__(self, name): | |
self.name = name | |
class Jedi (StarWarsCharacter): | |
def __init__(self, name, midichlorians): | |
super().__init__(name) | |
self.midichlorians = midichlorians |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def g(f): | |
def k(*args): | |
return 2 * f(*args) | |
return k | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def adder(n): | |
return lambda x : x + n | |
f = adder(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def adder(n): | |
return lambda x : x + n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fruits = {'banana', 'apple', 'orange', 'cherry'} | |
fruits.add('orange') # ¿qué hará esta línea? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fruits = {'banana', 'apple', 'orange', 'cherry'} |
NewerOlder