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
Technician A says that to cover all possible vehicle conditions, coolant must have a high freezing point. Technician B says cool
tiny-mole [99]
It would be option A!
please mark me brainliest ,
8 0
3 years ago
Read 2 more answers
Briefly explain what is net neutrality and why is it important today
ICE Princess25 [194]

Net neutrality also means that ISPs can't charge users access fees for particular websites. ... The goal of net neutrality is to ensure that businesses can compete freely on the internet without having to pay gatekeeper tolls. Without it consumers would look more like advertising segments than an open marketplace.

Credits: thestreet.com

6 0
3 years ago
In order for you to make a wireless connection it must first find an availble
erastova [34]
It sounds like you are looking for a network. If a node can not find a network to connect to, then it cannot connect.
7 0
3 years ago
Consider two different implementations, M1 and M2, of the same instruction set. There are three classes of instructions (A, B, a
ANTONII [103]

Answer:

a) the average CPI for machine M1 = 1.6

the average CPI for machine M2 = 2.5

b) M1 implementation is faster.

c) the clock cycles required for both processors.52.6*10^6.

Explanation:

(a)

The average CPI for M1 = 0.6 x 1 + 0.3 x 2 + 0.1 x 4

= 1.6

The average CPI for M2 = 0.6 x 2 + 0.3 x 3 + 0.1 x 4

= 2.5

(b)

The average MIPS rate is calculated as: Clock Rate/ averageCPI x 10^6

Given 80MHz = 80 * 10^6

The average MIPS ratings for M1 = 80 x 10^6  / 1.6 x 10^6

= 50

Given 100MHz = 100 * 10^6

The average MIPS ratings for M2 = 100 x 10^6 / 2.5 x 10^6

= 40

c)

Machine M2 has a smaller MIPS rating

Changing instruction set A from 2 to 1

The CPI will be increased to 1.9 (1*.6+3*.3+4*.1)

and hence MIPS Rating will now be (100/1.9)*10^6 = 52.6*10^6.

7 0
3 years ago
What is the quickest option for adding internet images to a power point presentation
Alex777 [14]

Answer:copy and paste

Explanation:

5 0
3 years ago
Other questions:
  • What can help you best learn about appearance, habitats and behaviors of birds in your area
    9·1 answer
  • Given the commands below, what do they do? for (position = 1 through aList.getLength()/2) { a = aList.getEntry(aList.getLength()
    11·1 answer
  • The part of the computer that provides access to the internet is the?
    14·1 answer
  • Implement the function pairSum that takes as parameters a list of distinct integers and a target value n and prints the indices
    11·1 answer
  • Tasks:_______.
    7·1 answer
  • A smart phone is always a _____.<br> client<br> server<br> network<br> process
    10·1 answer
  • Select the correct answer
    14·1 answer
  • How many characters does the "short text" have?
    9·1 answer
  • Tại sao xe chỉ sản xuất ra 1996cc mà không phải là 2000cc?
    6·2 answers
  • What is a photographic print made from a negative image?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!