Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Escribir una función que, dado un número máximo, retorne una lista con
- todos los números desde 1 hasta dicho número que sean simultáneamente
- múltiplos de 3 y de 5 (usar la operación resto con el carácter %).
- >>> multiplos(100)
- [15, 30, 45, 60, 75, 90]
- """
- def multiplos(numero):
- lista = []
- for x in range(1,numero):
- if x%3 == 0 and x%5 == 0:
- lista.append(x)
- return lista
- numero = int(input("Ingrese un nro: "))
- output = multiplos(numero)
- print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement