Python Program to Print All Even Data Element from Set

Python Program to Print All Even Data Element from Set


 my_set=set(map(int,input("Enter set element:").split()))

print("The set elements are:",my_set)

print("The even set elements are:",end=' ')

for i in my_set:

    if isinstance(i,int):

        if i%2==0:

            print(i,end=' ')


Output:

Enter set element:1 2 3 4 5 6 7 8 9 10

The set elements are: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

The even set elements are: 2 4 6 8 10 

टिप्पणी पोस्ट करा

0 टिप्पण्या