Created
October 29, 2017 01:01
-
-
Save franciscojsc/1dfe4fea4a6917217189cac463829828 to your computer and use it in GitHub Desktop.
Número par ou Impar em Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
I learned from this is
it worked
obrigado amigo!
Valeu !!!
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!')
Se eu te der o numero 18 o codigo n funciona, mas o numero continua sendo par
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.')
nice man
Obg !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very good