Python program to take the 20 integers and print positive , negative , odd and Even numbers seperatly.

 Code:-

print(“Enter 10 integers “)
mylist=list(map(int,input().split()))
print(“Positive numbers are:-“)
for i in mylist:
if i>0:
print(i,end=” “ )
print()
print(“Negative numbers are:-“)
for i in mylist:
if i<0:
print(i,end=” “)
print()
print(“Odd numbers are:-“)
for i in mylist:
if i %2!=0:
print(i,end=” “)
print()
print(“Even numbers are:-“)
for i in mylist:
if i%2==0:
print(i,end=” “)

Output:-

Enter 10 integers
1 2 3 4 5 6 7 45 65 8
Positive numbers are:-
1 2 4 7 45 65
Negative numbers are:-
3 5 6 8
Odd numbers are:-
1 3 5 7 45 65
Even numbers are:-
2 4 6 8




Leave a Reply

Your email address will not be published.