Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Created October 29, 2017 01:01
Show Gist options
  • Save franciscojsc/1dfe4fea4a6917217189cac463829828 to your computer and use it in GitHub Desktop.
Save franciscojsc/1dfe4fea4a6917217189cac463829828 to your computer and use it in GitHub Desktop.
Número par ou Impar em Python
numero = float(input('Digite um número para saber se é par ou impar:'))
resto = numero % 2
if resto == 0:
print('Número é par')
else:
print('Número é impar')
@Leonnmarshall
Copy link

Valeu !!!

@edmilsonchaves
Copy link

number = int(input("Digite o valor: "))

if number % 2 == 0:
print(f'O número {number} é par!')

else:
print(f'O número {number} é ímpar!')

@Brnaveia
Copy link

Se eu te der o numero 18 o codigo n funciona, mas o numero continua sendo par

@Aadrian0
Copy link

numero = input('Digite um número inteiro: ')

if numero.isdigit():
numero = int(numero)

if numero % 2 == 0:
    print(f'{numero} é par.')

else:
    print(f'{numero} é impar.')

else:
print('Isso não é um número.')

@marcio-andree
Copy link

nice man

@HenriKenn
Copy link

Obg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment