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
Nastasia [14]
3 years ago
15

Write a function that removes duplicates from an array. For example, if remove_ duplicates is called with an array containing 1

4 9 16 9 7 4 9 11 then the array is changed to 1 4 9 16 7 11 Your function should have a reference parameter for the array size that is updated when removing the duplicates.
Computers and Technology
1 answer:
velikii [3]3 years ago
8 0

Answer:

Explanation:

The following code is written in Python. It takes in an array of numbers as a parameter and loops through it. It checks to see if each element is already inside the new_arr array and if not then it adds it. Finally, it prints out the new_arr, prints the new_arr size and returns new_arr to the user which contains all the numbers from the original array without the duplicates.

def removeDuplicates(arr):

   new_arr = []

   for element in arr:

       if element not in new_arr:

           new_arr.append(element)

   print(new_arr)

   print("New Array Size: " + str(len(new_arr)))

   return new_arr

test_arr = [1, 4, 9, 16, 9, 7, 4, 9, 11]

removeDuplicates(test_arr)

You might be interested in
We write programs as a sequence of operation. they flow through the computer as?
lys-0071 [83]
I belive the correct answer would be binary code because computers see the coding as 00100001 
5 0
4 years ago
Time-management techniques work most effectively when performed in which order?
Sholpan [36]

Answer:

study-time survey, project schedule, prioritize tasks, reward system.

Explanation:

Time management can be defined as a strategic process which typically involves organizing, planning and controlling the time spent on an activity, so as to effectively and efficiently enhance productivity. Thus, when time is properly managed, it avails us the opportunity to work smartly rather than tediously (hardly) and as such making it possible to achieve quite a lot within a short timeframe. Also, a good time management helps us to deal with work-related pressures and tight schedules through the process of properly allocating the right time to the right activity.

Hence, time-management techniques work most effectively when performed in the following sequential order; study-time survey, project schedule, prioritize tasks, and designing (creating) a reward system.

4 0
3 years ago
While many myths are harmless, why can myths themselves be dangerous?
blondinia [14]

Answer:b

Explanation:

7 0
4 years ago
The undo function allows the user to cancel up to _____ previous typing actions
valina [46]
It can cancel up to 40 times.
4 0
4 years ago
Read 2 more answers
Look at the following Python code:
aliya0001 [1]

Ump will be assigned to word2

word1[0:3] gets all of the letters from index 0 to index 3 exclusive (that means index 3 is not included)

4 0
3 years ago
Other questions:
  • Can you recover deleted bookmarks on a Chromebook? If so, how?
    5·2 answers
  • What are three responsibilities of an operating system? please answer quick!!!
    9·1 answer
  • Create 3–5 questions about your data that can be answered by sorting and filtering the database.
    8·1 answer
  • Which of the following options allow you to access a computer remotely? Check all that apply.
    10·1 answer
  • Hi need help on this <br> what is cyberspace
    14·1 answer
  • Use MPLAB to write an asemply program to multipy two numbers (11111001) and (11111001). Then save the product in file reisters 0
    8·1 answer
  • We begin with a computer implemented in a single-cycle implementation. When the stages are split by functionality, the stages do
    13·1 answer
  • 10. Why antivirus is needed to be installed in computer system?
    8·1 answer
  • Who was the first person to develop http the language in which servers and browsers communicate
    11·1 answer
  • Consider the following method:
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!