Programming Examples
Create a Python program that removes even duplicate positive integer numbers (includes zero)
Create a Python program that removes even duplicate positive integer numbers (includes zero) from a list and prints the unique numbers in the order they first appeared.
If input is 4 3 2 1, then output should be 4 3 2 1.
If input is 0 0 0 0 1, then output should be 0 1.
If input is 1 1 3 3, then output should be 1 1 3 3.
Solutionnums = list(map(int, input("Enter numbers separated by space: ").split()))
seen_even = set()
result = []
for num in nums:
if num % 2 == 0: # even number (including 0)
if num not in seen_even:
result.append(num)
seen_even.add(num)
else: # odd number → keep all occurrences
result.append(num)
print("Output:", *result)
▶ RUN Output/ Explanation: