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
You have a sales chart and excel that you want to include in a 3rd quarter report to include in a 3rd quarter report quit it in
Nataliya [291]

Answer:

The paste function to use is the Advanced Paste Function that reads Use Destination Theme and Link Data or Keep Source Formatting and Link Data.

Explanation:

The first function adopts the Theme (such as colors, fonts, and other formatting) whilst retaining links to the data in the excel workbook. The latter imports the formatting or theme as-is from excel.

In both scenarios, (for as long as both documents are open and are in the same file) when the data in excel is opened and updated, it reflects automatically in the chart on the Microsoft Word document.

Cheers

5 0
2 years ago
The ampacity of a No. 12 aluminum wire with RHW insulation installed in a raceway that has 19 other wires is
GREYUIT [131]
<span>i believe the answer is C</span>
7 0
3 years ago
The proof that the Clique problem is NP-complete depends on a construction given in Theorem 34.11 (p. 1087), which reduces 3SAT
ki77a [65]

Answer:

Check the explanation

Explanation:

Kindly check the attached image below to see the step by step explanation to the question above.

5 0
3 years ago
Write a program that reads three integers as inputs, and outputs the largest of the three values.
AlexFokin [52]

The software is written in C++ and may be found in the explanation section below. C++ keywords and symbols are all capitalized. The least number of all three integers is determined via a nested if-else decision branch. After you've entered three integers, the application prints the least of them all.

<h3>What is the example of C++?</h3>

#include <iostream>

using namespace std;

int main() {

  int num1,num2,num3;

  cout<<"enter first integers"<<endl;

 cin>>num1;

  cout<<"enter second integers"<<endl;

  cin>>num2;

 cout<<"enter the third integers"<<endl;

  cin>>num3;

  if(num1<num2){

     if(num1<num3){

          cout<<"Smallest integer is "<<num1<<endl;

    } else{

          cout<<"Smallest integer is "<<num3<<endl;

      }

 }else {

 if(num2<num3){

    cout<<"Smallest integer is "<<num2<<endl;

} else{

    cout<<"Smallest integer is "<<num3<<endl;

     }

}

return 0;

}

Thus, it is written in C++ language.

For more details about C++ click here:

brainly.com/question/19581899

#SPJ1

3 0
2 years ago
PLEASE help me i dont get this at all
zepelin [54]

Answer:

dont know dont really care

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • Ben would like to let everyone in the class know about the topic his group is researching.
    14·1 answer
  • A viral video is one that can infect your computer with malware. <br> a. True <br> b. False
    6·1 answer
  • How to copy single slide to powerpoint
    15·1 answer
  • The most popular way for hackers to take over hosts today is ________.
    15·2 answers
  • What should you do before cleaning the top of a storage battery and rinsing it with fresh water?
    12·1 answer
  • Write a python program that requests a word (with lowercase letters) as input and translates the word into pig latin. The rules
    15·2 answers
  • State ONE (1) disadvantage of using computers to store and process<br> information.
    10·1 answer
  • Can you answer this question?
    9·1 answer
  • Explain ONE negative outcomes of not matching an ICT product to the correct audience:
    15·1 answer
  • 6.23 Lab training: Unit tests to evaluate your program Auto-graded programming assignments may use a Unit test to test small par
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!