75.5k views
2 votes
(Print distinct numbers) Write a program that reads in numbers

separated by a space in one line and displays distinct numbers (i.e., if
a number appears multiple times, it is displayed only once). (Hint:
Read all the numbers and store them in list1. Create a new list list2.
Add a number in list1 to list2. If the number is already in the list,
ignore it.)

User Chenware
by
7.6k points

1 Answer

4 votes

I've included my code in the picture below.

(Print distinct numbers) Write a program that reads in numbers separated by a space-example-1
User Neeka
by
7.9k points