Advertisement
EmilianoRoldanR

Verificar numero si es par o impar - Mis inicios en Python

Jan 17th, 2022
983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #Verificar si es par o impar.
  2.  
  3. def parimpar (numero):
  4.     resultadoparimpar = numero % 2;
  5.     if resultadoparimpar != 0:
  6.         resultado = "IMPAR";
  7.     else:
  8.         resultado = "PAR";
  9.     return resultado;
  10.  
  11. print("HOLA! BIENVENIDO AL CONSULTOR DE PARES E IMPARES.");
  12.  
  13. condicion = True;
  14. numero = 0;
  15.  
  16. while condicion == True:
  17.     if int(numero) > 1000 or int(numero) < 1:
  18.         numero = input("En que número estas pensando entre 1 y 1000?: ");
  19.     else:
  20.         condicion = False;
  21.  
  22. print("El numero " + numero + " es: " + parimpar(int(numero)));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement