How to check if a number is even or odd in Python
hello, In this tutorial we are going to learn how to check if a given number is even or odd in Python(Jupiter Notebook).
a=range (1,21)Even=[ ] Odd=[ ] for i in a: if i%2==0: Even.append(i) Else: Odd.append(i) or a=range (1,21) for i in a: if i%2==0: print("even") Else: print("odd")
Comments
Post a Comment