# Solucion examen ALS parcial 1 2018-19
def rota_izq( s, n) :
"""Rota una cadena de caracteres a la izquierda.
:param s: La cadena a rotar.
:param n: El num. de veces a rotar.
"""
toret = s
n %= len ( s)
if n >= 1 :
toret = s[ n:] + s[ :n]
return toret
def calcula_num_rotaciones_izq( s1, s2) :
"""Calcula n, el num. de rotaciones a la izquierda
necesarias para convertir s1 en s2.
:param s1: La cadena de referencia.
:param s2: La cadena resultado de rotar n veces.
:return: n, el num. de rotaciones necesarias.
"""
toret = -1
if ( s1 and s2
and len ( s1) == len ( s2) ) :
for i in range ( len ( s1) ) :
if rota_izq( s1, i) == s2:
toret = i
break
return toret
class Arbol:
"""Representa un arbol binario."""
def __init__ ( self , raiz, izqdo, drcho) :
self ._nodos = [ raiz, izqdo, drcho]
@ property
def raiz( self ) :
return self ._nodos[ 0 ]
@ property
def izqdo( self ) :
return self ._nodos[ 1 ]
@ property
def drcho( self ) :
return self ._nodos[ 2 ]
def recorrido_anchura( self ) :
return str ( self .raiz ) + " " + self ._recorrido_anchura( )
def _recorrido_anchura( self ) :
izqdo = ""
drcho = ""
izqdo_arbol = ""
drcho_arbol = ""
if isinstance ( self .izqdo , Arbol) :
izqdo = str ( self .izqdo .raiz )
izqdo_arbol = self .izqdo ._recorrido_anchura( )
elif self .izqdo :
izqdo = str ( self .izqdo )
if isinstance ( self .drcho , Arbol) :
drcho = str ( self .drcho .raiz )
drcho_arbol = self .drcho ._recorrido_anchura( )
elif self .drcho :
drcho = str ( self .drcho )
return ( ( izqdo.strip ( ) if izqdo else "" )
+ ( " " + drcho.strip ( ) if drcho else "" )
+ ( " " + izqdo_arbol.strip ( ) if izqdo_arbol else "" )
+ ( " " + drcho_arbol.strip ( ) if drcho_arbol else "" ) )
def __len__ ( self ) :
return max ( 0 , len ( [ x for x in self ._nodos if x != None ] ) - 1 )
def __getitem__ ( self , item) :
return self ._nodos[ item]
def __str__ ( self ) :
return str .format ( "{}({}, {})" , str ( self .raiz ) , str ( self .izqdo ) , str ( self .drcho ) )
class Movimiento:
"""Movimiento financiero."""
def __init__ ( self , concepto, mes, anno, num, precio) :
self ._concepto = concepto
self ._mes = mes
self ._anno = anno
self ._num = num
self ._precio = precio
@ property
def concepto( self ) :
return self ._concepto
@ property
def mes( self ) :
return self ._mes
@ property
def anno( self ) :
return self ._anno
@ property
def num( self ) :
return self ._num
@ property
def precio( self ) :
return self ._precio
@ property
def resultado( self ) :
return self .num * self .precio
def __str__ ( self ) :
return str .format ( "{:4d}/{:02d} {:15s} {:6d} x {:6d} = {:10d}" ,
self .anno ,
self .mes ,
self .concepto ,
self .num ,
self .precio ,
self .resultado )
class Publicidad( Movimiento) :
def __init__ ( self , concepto, anno, mes, num, precio) :
super ( ) .__init__ ( concepto, anno, mes, num, precio)
@ property
def resultado( self ) :
return super ( ) .resultado * -1 ;
def __str__ ( self ) :
return super ( ) .__str__ ( )
class Venta( Movimiento) :
def __init__ ( self , concepto, anno, mes, num, precio) :
super ( ) .__init__ ( concepto, anno, mes, num, precio)
def __str__ ( self ) :
return super ( ) .__str__ ( )
class Contenedor:
""" Contiene una lista de elementos asociados a un nombre. """
def __init__ ( self , nombre, elementos) :
self ._nombre = nombre
self ._elementos = elementos
@ property
def nombre( self ) :
return self ._nombre
@ property
def elementos( self ) :
return list ( self ._elementos)
def __str__ ( self ) :
return ( "-- " + self .nombre
+ "\n \t "
+ str .join ( "\n \t " ,
[ str ( x) for x in self ._elementos] ) )
class Empresa( Contenedor) :
""" Una empresa contiene su nombre y varios movimientos. """
def __init__ ( self , nombre, lista_movimientos) :
super ( ) .__init__ ( nombre, lista_movimientos)
class SeleccionEmpresas( Contenedor) :
"""Las empresas seleccionadas se guardan con un concepto. """
def __init__ ( self , nombre, lista_empresas) :
super ( ) .__init__ ( nombre, lista_empresas)
def prueba_ejercicio1( ) :
"""Pruebas sobre las rotaciones de cadenas. """
print ( "Rotaciones: abc/cab:" , calcula_num_rotaciones_izq( "abc" , "cab" ) , "=? 2" )
print ( "Rotaciones: abc/abc:" , calcula_num_rotaciones_izq( "abc" , "abc" ) , "=? 0" )
print ( "Rotaciones: abc/bca:" , calcula_num_rotaciones_izq( "abc" , "bca" ) , "=? 1" )
print ( "Rotaciones: abc/cca:" , calcula_num_rotaciones_izq( "abc" , "cca" ) , "=? -1" )
def prueba_ejercicio2( ) :
""" Pruebas sobre la clase Arbol. """
a1 = Arbol( 'a' , Arbol( 'b' , 'c' , 'd' ) , 'e' )
print ( "Arbol('a', Arbol('b', 'c', 'd'), 'e'): " , a1, "=? a(b(c, d), e)" )
print ( "a1[0] == a1.raiz == a =?" , a1[ 0 ] , "=?" , a1.raiz )
print ( "a1[1].raiz == a1.izqdo.raiz == b =?" , a1[ 1 ] .raiz , "=?" , a1.izqdo .raiz )
print ( "a1[2] == a1.drcho == e =?" , a1[ 2 ] , "=?" , a1.drcho )
print ( "len(a1) == " , len ( a1) , "=?" , 2 )
print ( "len(a1.izqdo) == " , len ( a1.izqdo ) , "=?" , 2 )
print ( "a1.recorrido_anchura == " , a1.recorrido_anchura ( ) , "=?" , "a b e c d" )
def prueba_ejercicio3( ) :
""" Pruebas sobre la selección de movimientos de empresas. """
selempresas = SeleccionEmpresas( "tech" , [
Empresa( "Microsoft" , [
Publicidad( "tv" , 2019 , 1 , 5 , 1500 ) ,
Venta( "windows" , 2019 , 1 , 50 , 500 ) ] ) ,
Empresa( "Google" , [
Publicidad( "tv" , 2019 , 1 , 15000 , 1 ) ,
Venta( "chromecast" , 2019 , 1 , 50 , 30 ) ] ) ] ) ;
print ( "\n " )
print ( selempresas)
print ( "\n =?\n " )
print ( """-- tech
-- Microsoft
1/2019 tv 5 x 1500 = -7500
1/2019 windows 50 x 500 = 25000
-- Google
1/2019 tv 15000 x 1 = -15000
1/2019 chromecast 50 x 30 = 1500""" )
if __name__ == "__main__" :
prueba_ejercicio1( )
prueba_ejercicio2( )
prueba_ejercicio3( )
IyBTb2x1Y2lvbiBleGFtZW4gQUxTIHBhcmNpYWwgMSAyMDE4LTE5CgoKZGVmIHJvdGFfaXpxKHMsIG4pOgogICAgIiIiUm90YSB1bmEgY2FkZW5hIGRlIGNhcmFjdGVyZXMgYSBsYSBpenF1aWVyZGEuCiAgICAKICAgICAgICA6cGFyYW0gczogTGEgY2FkZW5hIGEgcm90YXIuCiAgICAgICAgOnBhcmFtIG46IEVsIG51bS4gZGUgdmVjZXMgYSByb3Rhci4KICAgICIiIgogICAgCiAgICB0b3JldCA9IHMKICAgIAogICAgbiAlPSBsZW4ocykKICAgIGlmIG4gPj0gMToKICAgICAgICB0b3JldCA9IHNbbjpdICsgc1s6bl0KCiAgICByZXR1cm4gdG9yZXQKCgpkZWYgY2FsY3VsYV9udW1fcm90YWNpb25lc19penEoczEsIHMyKToKICAgICIiIkNhbGN1bGEgbiwgZWwgbnVtLiBkZSByb3RhY2lvbmVzIGEgbGEgaXpxdWllcmRhCiAgICAgICBuZWNlc2FyaWFzIHBhcmEgY29udmVydGlyIHMxIGVuIHMyLgogICAgICAgCiAgICAgICA6cGFyYW0gczE6IExhIGNhZGVuYSBkZSByZWZlcmVuY2lhLgogICAgICAgOnBhcmFtIHMyOiBMYSBjYWRlbmEgcmVzdWx0YWRvIGRlIHJvdGFyIG4gdmVjZXMuCiAgICAgICA6cmV0dXJuOiBuLCBlbCBudW0uIGRlIHJvdGFjaW9uZXMgbmVjZXNhcmlhcy4KICAgICIiIgogICAgCiAgICB0b3JldCA9IC0xCiAgICAKICAgIGlmIChzMSBhbmQgczIKICAgIGFuZCBsZW4oczEpID09IGxlbihzMikpOgogICAgICAgIGZvciBpIGluIHJhbmdlKGxlbihzMSkpOgogICAgICAgICAgICBpZiByb3RhX2l6cShzMSwgaSkgPT0gczI6CiAgICAgICAgICAgICAgICB0b3JldCA9IGkKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIAogICAgcmV0dXJuIHRvcmV0CgoKY2xhc3MgQXJib2w6CiAgICAiIiJSZXByZXNlbnRhIHVuIGFyYm9sIGJpbmFyaW8uIiIiCiAgICAKICAgIGRlZiBfX2luaXRfXyhzZWxmLCByYWl6LCBpenFkbywgZHJjaG8pOgogICAgICAgIHNlbGYuX25vZG9zID0gW3JhaXosIGl6cWRvLCBkcmNob10KICAgICAgICAKICAgIEBwcm9wZXJ0eQogICAgZGVmIHJhaXooc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYuX25vZG9zWzBdCiAgICAKICAgIEBwcm9wZXJ0eQogICAgZGVmIGl6cWRvKHNlbGYpOgogICAgICAgIHJldHVybiBzZWxmLl9ub2Rvc1sxXQogICAgCiAgICBAcHJvcGVydHkKICAgIGRlZiBkcmNobyhzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi5fbm9kb3NbMl0KICAgIAogICAgZGVmIHJlY29ycmlkb19hbmNodXJhKHNlbGYpOgogICAgICAgIHJldHVybiBzdHIoc2VsZi5yYWl6KSArICIgIiArIHNlbGYuX3JlY29ycmlkb19hbmNodXJhKCkKICAgIAogICAgZGVmIF9yZWNvcnJpZG9fYW5jaHVyYShzZWxmKToKICAgICAgICBpenFkbyA9ICIiCiAgICAgICAgZHJjaG8gPSAiIgogICAgICAgIGl6cWRvX2FyYm9sID0gIiIKICAgICAgICBkcmNob19hcmJvbCA9ICIiCiAgICAgICAgCiAgICAgICAgaWYgaXNpbnN0YW5jZShzZWxmLml6cWRvLCBBcmJvbCk6CiAgICAgICAgICAgIGl6cWRvID0gc3RyKHNlbGYuaXpxZG8ucmFpeikKICAgICAgICAgICAgaXpxZG9fYXJib2wgPSBzZWxmLml6cWRvLl9yZWNvcnJpZG9fYW5jaHVyYSgpCiAgICAgICAgZWxpZiBzZWxmLml6cWRvOgogICAgICAgICAgICBpenFkbyA9IHN0cihzZWxmLml6cWRvKQogICAgICAgICAgICAKICAgICAgICBpZiBpc2luc3RhbmNlKHNlbGYuZHJjaG8sIEFyYm9sKToKICAgICAgICAgICAgZHJjaG8gPSBzdHIoc2VsZi5kcmNoby5yYWl6KQogICAgICAgICAgICBkcmNob19hcmJvbCA9IHNlbGYuZHJjaG8uX3JlY29ycmlkb19hbmNodXJhKCkKICAgICAgICBlbGlmIHNlbGYuZHJjaG86CiAgICAgICAgICAgIGRyY2hvID0gc3RyKHNlbGYuZHJjaG8pCiAgICAgICAgICAgIAogICAgICAgIHJldHVybiAoKGl6cWRvLnN0cmlwKCkgaWYgaXpxZG8gZWxzZSAiIikKICAgICAgICAgICAgICAgICsgKCIgIiArIGRyY2hvLnN0cmlwKCkgaWYgZHJjaG8gZWxzZSAiIikKICAgICAgICAgICAgICAgICsgKCIgIiArIGl6cWRvX2FyYm9sLnN0cmlwKCkgaWYgaXpxZG9fYXJib2wgZWxzZSAiIikKICAgICAgICAgICAgICAgICsgKCIgIiArIGRyY2hvX2FyYm9sLnN0cmlwKCkgaWYgZHJjaG9fYXJib2wgZWxzZSAiIikpCiAgICAKICAgIGRlZiBfX2xlbl9fKHNlbGYpOgogICAgICAgIHJldHVybiBtYXgoMCwgbGVuKFt4IGZvciB4IGluIHNlbGYuX25vZG9zIGlmIHggIT0gTm9uZV0pIC0gMSkKICAgIAogICAgZGVmIF9fZ2V0aXRlbV9fKHNlbGYsIGl0ZW0pOgogICAgICAgIHJldHVybiBzZWxmLl9ub2Rvc1tpdGVtXQogICAgCiAgICBkZWYgX19zdHJfXyhzZWxmKToKICAgICAgICByZXR1cm4gc3RyLmZvcm1hdCgie30oe30sIHt9KSIsIHN0cihzZWxmLnJhaXopLCBzdHIoc2VsZi5penFkbyksIHN0cihzZWxmLmRyY2hvKSkKCgpjbGFzcyBNb3ZpbWllbnRvOgogICAgIiIiTW92aW1pZW50byBmaW5hbmNpZXJvLiIiIgogICAgCiAgICBkZWYgX19pbml0X18oc2VsZiwgY29uY2VwdG8sIG1lcywgYW5ubywgbnVtLCBwcmVjaW8pOgogICAgICAgIHNlbGYuX2NvbmNlcHRvID0gY29uY2VwdG8KICAgICAgICBzZWxmLl9tZXMgPSBtZXMKICAgICAgICBzZWxmLl9hbm5vID0gYW5ubwogICAgICAgIHNlbGYuX251bSA9IG51bQogICAgICAgIHNlbGYuX3ByZWNpbyA9IHByZWNpbwogICAgICAgIAogICAgQHByb3BlcnR5CiAgICBkZWYgY29uY2VwdG8oc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYuX2NvbmNlcHRvCiAgICAKICAgIEBwcm9wZXJ0eQogICAgZGVmIG1lcyhzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi5fbWVzCiAgICAKICAgIEBwcm9wZXJ0eQogICAgZGVmIGFubm8oc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYuX2Fubm8KICAgIAogICAgQHByb3BlcnR5CiAgICBkZWYgbnVtKHNlbGYpOgogICAgICAgIHJldHVybiBzZWxmLl9udW0KICAgIAogICAgQHByb3BlcnR5CiAgICBkZWYgcHJlY2lvKHNlbGYpOgogICAgICAgIHJldHVybiBzZWxmLl9wcmVjaW8KCiAgICBAcHJvcGVydHkKICAgIGRlZiByZXN1bHRhZG8oc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYubnVtICogc2VsZi5wcmVjaW8KCiAgICBkZWYgX19zdHJfXyhzZWxmKToKICAgICAgICByZXR1cm4gc3RyLmZvcm1hdCgiezo0ZH0vezowMmR9IHs6MTVzfSB7OjZkfSB4IHs6NmR9ID0gezoxMGR9IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYW5ubywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYubWVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jb25jZXB0bywgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLm51bSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJlY2lvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5yZXN1bHRhZG8pCgoKY2xhc3MgUHVibGljaWRhZChNb3ZpbWllbnRvKToKICAgIGRlZiBfX2luaXRfXyhzZWxmLCBjb25jZXB0bywgYW5ubywgbWVzLCBudW0sIHByZWNpbyk6CiAgICAgICAgc3VwZXIoKS5fX2luaXRfXyhjb25jZXB0bywgYW5ubywgbWVzLCBudW0sIHByZWNpbykKICAgICAgICAKICAgIEBwcm9wZXJ0eQogICAgZGVmIHJlc3VsdGFkbyhzZWxmKToKICAgICAgICByZXR1cm4gc3VwZXIoKS5yZXN1bHRhZG8gKiAtMTsKICAgIAogICAgZGVmIF9fc3RyX18oc2VsZik6CiAgICAgICAgcmV0dXJuIHN1cGVyKCkuX19zdHJfXygpCgoKY2xhc3MgVmVudGEoTW92aW1pZW50byk6CiAgICBkZWYgX19pbml0X18oc2VsZiwgY29uY2VwdG8sIGFubm8sIG1lcywgbnVtLCBwcmVjaW8pOgogICAgICAgIHN1cGVyKCkuX19pbml0X18oY29uY2VwdG8sIGFubm8sIG1lcywgbnVtLCBwcmVjaW8pCiAgICAgCiAgICBkZWYgX19zdHJfXyhzZWxmKToKICAgICAgICByZXR1cm4gc3VwZXIoKS5fX3N0cl9fKCkKCgpjbGFzcyBDb250ZW5lZG9yOgogICAgIiIiIENvbnRpZW5lIHVuYSBsaXN0YSBkZSBlbGVtZW50b3MgYXNvY2lhZG9zIGEgdW4gbm9tYnJlLiAiIiIKICAgIAogICAgZGVmIF9faW5pdF9fKHNlbGYsIG5vbWJyZSwgZWxlbWVudG9zKToKICAgICAgICBzZWxmLl9ub21icmUgPSBub21icmUKICAgICAgICBzZWxmLl9lbGVtZW50b3MgPSBlbGVtZW50b3MKICAgIAogICAgQHByb3BlcnR5CiAgICBkZWYgbm9tYnJlKHNlbGYpOgogICAgICAgIHJldHVybiBzZWxmLl9ub21icmUKICAgIAogICAgQHByb3BlcnR5CiAgICBkZWYgZWxlbWVudG9zKHNlbGYpOgogICAgICAgIHJldHVybiBsaXN0KHNlbGYuX2VsZW1lbnRvcykKICAgIAogICAgZGVmIF9fc3RyX18oc2VsZik6CiAgICAgICAgcmV0dXJuICgiLS0gIiArIHNlbGYubm9tYn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xlY2Npb25FbXByZXNhcygidGVjaCIsIFsKICAgICAgICAgICAgICAgICAgICAgICAgRW1wcmVzYSgiTWljcm9zb2Z0IiwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgUHVibGljaWRhZCgidHYiLCAyMDE5LCAxLCA1LCAxNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZlbnRhKCJ3aW5kb3dzIiwgMjAxOSwgMSwgNTAsIDUwMCldKSwKICAgICAgICAgICAgICAgICAgICAgICAgRW1wcmVzYSgiR29vZ2xlIiwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgUHVibGljaWRhZCgidHYiLCAyMDE5LCAxLCAxNTAwMCwgMSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBWZW50YSgiY2hyb21lY2FzdCIsIDIwMTksIDEsIDUwLCAzMCldKV0pOwogICAgcHJpbnQoIlxuIikKICAgIHByaW50KHNlbGVtcHJlc2FzKQogICAgcHJpbnQoIlxuPT9cbiIpCiAgICBwcmludCgiIiItLSB0ZWNoCiAgICAgICAgLS0gTWljcm9zb2Z0CiAgICAgICAgICAgMS8yMDE5IHR2ICAgICAgICAgICAgICAgICAgIDUgeCAgIDE1MDAgPSAgICAgIC03NTAwCiAgICAgICAgICAgMS8yMDE5IHdpbmRvd3MgICAgICAgICAgICAgNTAgeCAgICA1MDAgPSAgICAgIDI1MDAwCiAgICAgICAgLS0gR29vZ2xlCiAgICAgICAgICAgMS8yMDE5IHR2ICAgICAgICAgICAgICAgMTUwMDAgeCAgICAgIDEgPSAgICAgLTE1MDAwCiAgICAgICAgICAgMS8yMDE5IGNocm9tZWNhc3QgICAgICAgICAgNTAgeCAgICAgMzAgPSAgICAgICAxNTAwIiIiKQogICAgCiAgICAKaWYgX19uYW1lX18gPT0gIl9fbWFpbl9fIjoKICAgIHBydWViYV9lamVyY2ljaW8xKCkKICAgIHBydWViYV9lamVyY2ljaW8yKCkKICAgIHBydWViYV9lamVyY2ljaW8zKCkK