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
yan [13]
3 years ago
9

Write a function named remove_duplicates that takes a list (of numeric and/or string values) and returns a new list with only th

e unique elements from the original. This function assumes that there is at least 1 element in the list and that the list does not contain any sublists. The original list is not modified in any way. The returned list does not have to preserve the order of the original list.
Computers and Technology
1 answer:
Lorico [155]3 years ago
6 0

Answer:

def remove_duplicates(lst):

   no_duplicate = []

   dup = []

   for x in lst:

       if x not in no_duplicate:

           no_duplicate.append(x)

       else:

           dup.append(x)

   for y in dup:

       if y in no_duplicate:

           no_duplicate.remove(y)

   return no_duplicate

Explanation:

Create a function called remove_duplicates that takes one parameter, lst

Create two lists one for no duplicate elements and one for duplicate elements

Create for loop that iterates through the lst. If an element is reached for first time, put it to the no_duplicate. If it is reached more than once, put it to the dup.

When the first loop is done, create another for loop that iterates through the dup. If one element in no_duplicate is in the dup, that means it is a duplicate, remove that element from the no_duplicate.

When the second loop is done, return the no_duplicate

You might be interested in
A junior network administrator tells you that he can ping a DNS server successfully using its IP address, but he has not tested
Darya [45]

Answer:

nslookup is the correct answer to the following question.

Explanation:

The following answer is correct because It is the tool or the utility of the command line by which an administrator to query a DNS(Domain Name System) for finding the domain name or the Internet Protocol address or many other records.

<u>Steps to use nslookup:</u>

  • Firstly, you have to press the window key + R to open run.
  • Then, you have to type cmd in it and press enter.
  • Then, cmd will appear after that, you have to type the command 'nslookup' and then press enter.
  • Then, it shows the default server name and ip address after that, you have to type an ip address of DNS server.
  • Then, you have to type 'set' then type q=M X and then press enter
  • Then, you have to type the name of your domain then, press enter key.

7 0
3 years ago
A counter is a tool used to measure the number of times people visit a Web site. true or false?
Liono4ka [1.6K]

True.

It doesn't measure unique users, so you can just hit refresh and the counter keeps going up...

5 0
4 years ago
Write a program that can be used as a math tutor for a young student. The program should display two random numbers (in the rang
levacccp [35]

Answer:

Code:

//<em>Needed Libraries</em>

#include <iostream>

#include <iomanip>

#include <cstdlib>

#include <ctime>

//<em>starting the program</em>

using namespace std;

int main()

{

//<em>Creating the variables needed</em>

double X,Y,Z;

//<em>command for generating random number every time the program runs. </em>

//<em>without it the program default value will be srand(1). </em>

srand(time(0));

// <em>printing the lines to show user what to do.</em>

cout << "Hello, Welcome to Math's Tutor " << endl;

cout << "I will be helping you learn addition today." << "\n\n";

cout << "I will display two random numbers, Solve for the answer." << endl;

//<em>doing the needed calculations and putting the sum in Z</em>

X = 1 + rand() % 500;

Y = 1 + rand() % 500;

Z = A + B;

//<em>printing the value for user to solve</em>

cout << "\n";

cout << X << " + " << Y << " = " << endl;

// <em>pausing the system for user to solve the problem and press any key</em>

system("pause");

//<em>showing the answer to the problem</em>

cout << X << " + " << Y << " = " << Z << endl;

return 0;

}

Explanation:

the above program will print some lines for showing user what to do and then displaying the numbers for user to solve for the answer and then let the user to see the answer when the user press any key.

the random number shown will be between 1 to 500. if the user want to change the range so

X = 1 + rand() % 500;

Y = 1 + rand() % 500;

Put the number for your range instead of 500. It can be 1000, 5000, etc it will increase the range if you want to decrease it then pu a lower number then 500 instead.

After it will allow the user to solve the problem. then show the answer when user press any key.

7 0
4 years ago
// isOrdered
yarga [219]

Answer:

honestly i dont know but I used to have computer programming classes on java and I'd get all my answers from repl.it forums. Wist you best of luck!!

6 0
3 years ago
In the following script, what is "print()”?
Bumek [7]

Answer:

It is a method

Explanation:

4 0
3 years ago
Other questions:
  • You have been given two classes, a Main.java and a Coin.java. The coin class represents a coin. Any object made from it will hav
    13·1 answer
  • You have opened the properties dialog box for an installed printer on your computer system. on what tab will you find informatio
    8·1 answer
  • Where may an operating system reside in a mobile device?
    5·1 answer
  • Which quality of service (QoS) mechanism provided by the network does real-time transport protocol (RTP) rely on to guarantee a
    13·1 answer
  • According to the computer science what isCD ROM is a ​
    8·1 answer
  • What is the location in the base interface of the link to
    7·1 answer
  • তথ্য ও যোগাযোগ প্রযুক্তির প্রশ্ন(45)10 সংখ্যাটির সমতুল্য মান?
    14·1 answer
  • Will Give Brainliest
    10·1 answer
  • Select the device that will have the most network ports
    8·1 answer
  • Write a function that takes a list and returns its first element​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!