Select Git revision
-
Romain Vuillemot authoredRomain Vuillemot authored
math-parite.py 454 B
def parite(a):
""" Lire un entier au clavier et décider (et afficher) s'il est pair ou impair. """
if (a%2 == 1):
print(a, " est impair")
else :
print(a, " est pair")
if __name__=="__main__":
while True:
try:
a = int(input('Donner un entier positif : '))
parite(a)
break
except ValueError:
print("Ce n'est pas un nombre valide.. ré-essayer !")