DEV Community

Cover image for Ibuprofeno.py💊| #88: Explica este código Python
Cristian Fernando
Cristian Fernando

Posted on

Ibuprofeno.py💊| #88: Explica este código Python

Explica este código Python

Dificultad: Fácil

def f(n):
    aux = 5
    r = []
    while aux <= n:
        r.append(aux)
        aux +=5
    return r
print(f(36))
Enter fullscreen mode Exit fullscreen mode

👉 A. [10, 15, 20, 25, 30, 35]
👉 B. [5, 10, 15, 20, 25, 30, 35]
👉 C. [5, 10, 15, 20, 25, 30]
👉 D. SyntaxError


Respuesta:

👉 B. [5, 10, 15, 20, 25, 30, 35]

Lo que hace nuestra función solamente es agregar los numeros múltiplos menores a un número dado, en este caso, todos los menores a 36.

Almacenamos cada valor en un lista y la imprimimos por consola.

Top comments (2)

Collapse
 
opensourceyllen profile image
Yllen Fernandez

Me gusta mucho tu manera de crear y explicar challenges 🤯

Collapse
 
duxtech profile image
Cristian Fernando

Muchas gracias por tu comentario. A mi me gusta mucho poder compartir el conocimiento para que todos podamos aprender. Un saludo!

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay