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]
3 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]3 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
To activate Spelling and Grammar check using the ribbon, navigate first to the _____ tab
hoa [83]
The auto correct tab.
6 0
3 years ago
Read 2 more answers
Give me reasons why Harry Potter is bad and anime is better
andrew11 [14]

Answer:

Harry Potter is Horrible

Explanation:

Anime is simply better... some 14 year old who has some horrible scar just simply isnt cool! with anime, you have demon slayer, attack on titan, naruto etc. Also pokemon could beat harry potter any day. please just give it a chance :)

4 0
2 years ago
What are the advantages of using an external style sheet?
goldenfox [79]

Answer:

The benefits of using an external style sheet are:

Explanation:

everything is stored within a single file.

once changed/updated, the changes are reflected on all other pages that reference the stylesheet.

this makes it easier to maintain larger websites.

pages load quicker once the main CSS file has been cached.

6 0
3 years ago
Given a link with a maximum transmission rate of 18 Mbps. Only two computers, X and Y, wish to transmit starting at time t = 0 s
expeople1 [14]

Answer:

<em>Total time taken = 0.62 seconds </em>

Explanation:

<em>Transmission rate =  18 Mbps</em>

The size of file X winch will go fast= 11.73 MiB (Mebibyte) = 8.38 Mb(Megabit)  

The time it will take to transfer = File size / Transmission rate

                                                = 8.38 / 18 seconds

                                                = 0.46 seconds  

Mb in 1 KiB = 116.415  

The file Y that will go next has size = 340 Kib

                                                       = 340 / 116.41 Mb

                                                       = 2.92 Mb  

The time it will take to transfer = 2.92 / 18 seconds

                                                = 0.16

<em>Total time = Time taken for file X + Time taken for file Y </em>

<em>= 0.46 + 0.16 </em>

<em>= 0.62 </em>

<em />

3 0
4 years ago
Technician A says that a camshaft must open and close each valve at exactly the right time relative to piston position. Technici
morpeh [17]
On single and double overhead cam engines, the cams are driven by the crankshaft, via either a belt or chain called the timing belt or timing chain. These belts and chains need to be replaced or adjusted at regular intervals.
3 0
3 years ago
Other questions:
  • All phones must have a way of making and then terminating a connection to the phone network; however the exact procedure for doi
    6·1 answer
  • Which of the following is where you can save, select a template, change document properties, and close or exit excel?
    8·1 answer
  • HURRY
    5·1 answer
  • Does anyone know answers for reading plus level h and j
    13·2 answers
  • In the following data definition, assume that List2 begins at offset 2000h. What is the offset of the third value (5)?
    10·1 answer
  • ,ll<br><br><br><br> hmvcvmhbbb b cbc bc bc b cb cbcb c
    13·1 answer
  • Q.drtrdyudoijoemrkdf
    6·2 answers
  • Computer identity theft differs from theft in the real world in what major way?
    11·2 answers
  • Who else is on spring break till april 12th?
    15·2 answers
  • Your agile team only has one database developer. So the other developers finish their tasks and then wait for their work to be I
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!