1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anika [276]
2 years ago
8

(Print distinct numbers) Write a program that reads in integers separated by a space in one line and displays distinct numbers i

n their input order and separated by exactly one space (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.
Computers and Technology
1 answer:
irina [24]2 years ago
6 0

Answer:

Following are the program to the given question:

num = input("Enter numbers: ")#defining a variable num for input value  

list1 = num.split()#defining a list1 that adds value in list1  

list2 = []#defining an empty list list2

for j in range(len(list1)):#defining a for loop that checks the list value in range  

   if not list1[j] in list2:# use if block that checks multiple value

       list2.append(list1[j])#add value in list2

print("The distinct numbers are: ")#print message

for j in range(len(list2)):#defining for loop for print list value

   print(list2[j])#print list value

Output:

Enter numbers: 1 22 55 7 22 1 1 2 3

The distinct numbers are:  

1

22

55

7

2

3

Explanation:

In the above-code, a "num" variable is defined, that takes inputs from the console screen, and in the next step, "list1 and list2" is defined. In the "list1" it adds num variable value a into the list.

In the next step, a for loop is defined that checks the list value in range , and define an if block, that checks multiple value and add value into the list2, and in the next step, the for loop is defined that prints the list2 values.    

You might be interested in
I need help pls, in this code if add row for example :
tankabanditka [31]
I thing is going project experiment everyone make plans and
3 0
3 years ago
Which statement compares the copy and cut commands?
ella [17]

Answer: duplicate

Explanation:

5 0
3 years ago
Read 2 more answers
Where does the report footer section appear?
natka813 [3]

The report footer section appears at the bottom of the last page. The correct option is b.

<h3>What is a report footer section?</h3>

The report footer is that contain the report items. It is placed in the last page or the bottom of the report border. It is present only one time exactly at the last page.

Thus, the correct option is b, at the bottom of the last page.

Learn more about report footer section

brainly.com/question/13261774

#SPJ1

3 0
2 years ago
What kind of table is a pasted Word table that can be edited with Word from within PowerPoint without changing the data in your
igomit [66]

D. Integrated

Or

A. Embedded

7 0
3 years ago
Read 2 more answers
Which platforms they thinks is better to use for sharing their content,ideas,and stories?
aliina [53]
I personally believe a blogging site is better to use to share content, ideas, and stories because the main point of a blogging site is to show your ideas with other people but I also believe social networking site is good too because there’s a lot of people who use social media to share and show what they believe.
Hope this helps
5 0
3 years ago
Other questions:
  • Nicole wants to create a database to collect information about sales transactions. She would like to use the database to look up
    6·2 answers
  • What special member function of a class is called whenever an instance of a class is created and initialized?
    15·1 answer
  • Im trying to learn c# for unity does anyone know any good sources
    10·1 answer
  • Can web sites contain copyright material? <br> Yes <br> No
    10·2 answers
  • is a private connection of LANs and WANs that belongs to an organization, and is designed to be accessible only by the members a
    14·1 answer
  • . Write programming code in C++ for school-based grading system
    8·1 answer
  • Program Convert Measurements:
    15·1 answer
  • How to set Campaign goals?
    11·1 answer
  • Memorex Disks sells computer disk drives with right-of-return privileges. Returns are material and reasonably predictable. Memor
    7·1 answer
  • How do I add a Child to my Brainly account
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!