Create a program that contains two methods, one for displaying all even numbers from 1
to 10 and the other one displays all odd numbers from 1-10.
def even_numbers():
res = ""
for i in range(1, 11):
if(i % 2 == 0):
res += str(i) + " "
print(res)
def odd_number():
res = ""
for i in range(1, 11):
if(i % 2 != 0):
res += str(i) + " "
print(res)
even_numbers()
odd_number()
Comments
Leave a comment