num = int(input('Ingrese un numero entero: '))
r1 = num % 3
r2 = num % 5
if r1==0 and r2==0:
print('Número mágico!')
elif r1==0:
print('Divisible por 3')
elif r2==0:
print('Divisible por 5')
else:
print('No es un número mágico')
num = int(input('Ingrese un numero entero: '))
r1 = num % 3
r2 = num % 5
if r1==0 and r2==0:
print('Número mágico!')
elif r1==0:
print('Divisible por 3')
elif r2==0:
print('Divisible por 5')
else:
print('No es un número mágico')
numero = int(input("digite un número entero: "))
if numero % 3 == 0 and numero % 5 == 0:
print("número mágico")
elif numero % 3 == 0:
print("divisible por 3")
elif numero % 5 == 0:
print("divisible por 5")
else:
print("no es número mágico")
yo lo hice así
Tú solución me parece fantástica!
Evitas declarar más variables de las que realmente se necesitan logrando un código mas limpio y eficiente (uso de memoria).
Excelente!