Skip to content

Instantly share code, notes, and snippets.

@pigmonchu
pigmonchu / question2.py
Last active November 29, 2021 16:37
Segunda cuestion
def f(ht):
b = 0
for elt in ht:
b = elt + b
return b
def m(k):
return (k % 2) == 0
def s(m, n):
r = None
if m <= n:
r = m
else:
r = n
return r
def interes_anual(cantidad, interes):
return cantidad * (1 + interes / 100)
def retorno_inversion(cantidad, interes, anyos):
r = []
for anyo in range(anyos):
cantidad = interes_anual(cantidad, interes)
r.append(round(cantidad, 2))
return r
def applyToEachString(stringFunction, *words):
myList = []
for word in words:
# ¿Qué instrucción debe ir aquí?
return tuple(myList)
def onlyVowels(word):
vowels = 'aeiouáéíóúü'
resp = ""
for letter in word:
def applyToEachString(stringFunction, *words):
myList = []
for word in words:
# ¿Qué instrucción debe ir aquí?
return tuple(myList)
def what_i_do(p1, p2):
if p2 < len(p1):
return p1
gap = (p2 - len(p1)) // 2
return " " * gap + p1
def second_scored(*lis):
maximum = max(lis)
preMax = min(lis)
for nombre in lis:
if (nombre < maximum and nombre > preMax):
preMax = nombre
return preMax
"""
-EL COMENTARIO-
def n(a):
return (a % 2) == 0
def p(k):
return not n(k)
def g(xxs):
k = 1
for elm in xxs:
k = k * elm
return k