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
zubka84 [21]
3 years ago
7

Write a method doubleUp that doubles the size of a list of integers by doubling-up each element in the list. Assume there's enou

gh space in the array to double the size.
Computers and Technology
1 answer:
Savatey [412]3 years ago
6 0

Answer:

The solution in Python is as follows:

class myClass:

    def doubleUp(self,doubleList):

         doubleList[:0] = doubleList[::2] = doubleList[1::2] = doubleList[:]

       

newlist =  []

n = int(input("Number of elements: "))

for i in range(n):

    num = int(input(": "))

    newlist.append(num)

   

list = myClass()

list.doubleUp(newlist)

print(newlist)

Explanation:

Start by creating a class

The solution in Python is as follows:

class myClass:

Then define the method doubleUp

    def doubleUp(self,doubleList):

The duplicates is done here

         doubleList[:0] = doubleList[::2] = doubleList[1::2] = doubleList[:]

The program main begins here

This defines an empty list        

newlist =  []

This prompts user for number of elements

n = int(input("Number of elements: "))

The following iteration get the elements of the list

<em>for i in range(n):</em>

<em>     num = int(input(": "))</em>

<em>     newlist.append(num)</em>

   

This defines the instance of the class

list = myClass()

This calls the method

list.doubleUp(newlist)

Lastly, this prints the duplicate list

print(newlist)

You might be interested in
Think of a recent occasion when you became upset with a friend or family member. How did you handle the situation? How did you c
bekas [8.4K]

Answer:

You would identify the problem together with the person or persons involved.

Explanation:

4 0
3 years ago
Which of the following would not be considered a polymer?
miskamm [114]
Correct answer would be <span>A) <u>quartz</u></span>.  Plastic, nylon, and rubber can all be broken down or heated to make it expand, and be used in common products.

Hope this helped :)
3 0
3 years ago
Read 2 more answers
Consider the following scenario and prescribe a solution. Situation: Tenisha is moving to Ohio to attend college. It is very hum
xz_007 [3.2K]

Answer:

Unplug the computer during a lightning storm

Explanation:

If there is a lightning storm you should always unplug your laptop or laptop or computer. If the lightning hits your computer you fried it and you can't use it anymore, but, if you unplug it it will save it from getting it fried. Always unplug your your computer during a lightning storm!

Hope it helps! :D

Have a great day! :)

3 0
3 years ago
___ refers to the use of key performance indicators to monitor performance of the entire supply chain, including sourcing, plann
Komok [63]

Answer:

Supply chain analytics

Explanation:

-Supply chain analytics refers to analyzing data using different tools that allow to evaluate the performance of the supply chain and make decisions.

-Supply chain strategy refers to the plan the company designs to take the products from suppliers to distributors.

-Supply chain visibility refers to the company being able to know where the inventory is when it is moved from the producer to the destination.

-Supply chain optimization refers to everything the company uses to have the best supply chain operation possible.

-Supply chain integration is when all the steps of the process involved in manufacturing a product and getting it to its final destination are integrated.

According to this, the answer is that supply chain analytics refers to the use of key performance indicators to monitor performance of the entire supply chain, including sourcing, planning, production, and distribution.

7 0
3 years ago
A typical pda includes a(n) _____.
Ratling [72]
A.External Monitor.Hope I helped.
5 0
3 years ago
Read 2 more answers
Other questions:
  • What acts as a platform on which application software runs?
    8·1 answer
  • Some financial institutions can be really bad about putting unexpected charges
    12·1 answer
  • A technician is talking to end users about the specifications for an upgraded application server. The users of the application r
    11·1 answer
  • The lightbulb transfers electricity energy into light what is one type of energy that is also generated that is not a desired af
    14·1 answer
  • Peter has recently bought a media player and a digital camera he wants to buy a memory card and then use devices which memory do
    11·2 answers
  • The "origin" of the cartesian plane in math is the point where x and y are both zero. Given a variable, origin of type Point-- a
    5·1 answer
  • Why did Hunter gatherers moved into the<br>America's?​
    8·1 answer
  • PowerPoint provides a wide variety of predefined shapes that can add visual insert to a slide true or false
    10·2 answers
  • Hi weegy, what is the latest android os?
    9·1 answer
  • Susan has always wanted to be a veterinarian. When doing her research, she answers all self-assessments geared toward that caree
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!