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
Maeve has created the website, but she is not able to include more than one blank space at a time. Even if she hits the SPACE bu
GenaCL600 [577]

Answer:

For the browser to display multiple spaces, Maeve must use &nbsp; in her code to create more spaces.

Explanation:

&nbsp; is known as hard space or fixed space. NBSP stands for Non-Breaking Space. The statement will continue without breaking into another line.

Maeve can easily use the &nbsp; many times to get the required space she needs.

5 0
3 years ago
You need to perform maintenance on a router and need to temporarily reroute traffic through another office. which would be the b
Whitepunk [10]
<span>In order to perform maintenance on a router and need to temporarily reroute traffic through another office  the best way to perform this action would be to configure a static route on the router.
</span>By doing this, the router will use the manually-<span>configured routing entry to send the packets.</span>
3 0
3 years ago
Steve is happy today but he ____ yesterday​
suter [353]

steve is happy today but he wasn't yesterday

3 0
2 years ago
Read 2 more answers
if you want to exclude a portion of an image which option should be chosen?? A. Arrange B. Position C. Crop D. Delete
Anuta_ua [19.1K]
It would be C- crop. This allows you to specifically delete parts of the image using drag and drop features. Hope this helps!
3 0
2 years ago
_____ are like selection lists in which they limit fields to a set of possible values; but, unlike selection lists, the options
natali 33 [55]

Radio buttons exist like selection lists in which they limit fields to a set of potential values; but, unlike selection lists, the options appear as respective controls in the web form.

<h3>What is Radio button?</h3>

A radio button or option button exists as a graphical control element that permits the user to select only one of a predefined set of mutually exclusive options. The singular property of a radio button causes it distinct from checkboxes, where the user can select and unselect any numeral of items.

Radio buttons exist as a common way to permit users to make a single selection from a list of options. Since only one radio button can be selected at a period (within the same group), each available option must be its item and label. Radio buttons exist like selection lists in which they limit fields to a set of potential values; but, unlike selection lists, the options appear as respective controls in the web form.

To learn more about Radio button refer to:

brainly.com/question/20476366

#SPJ4

8 0
1 year ago
Other questions:
  • What kind of game was Pole Position?
    14·1 answer
  • Does a soda vending machine Give reciepts?<br><br>need for computer science hw
    7·2 answers
  • In a computerized accounting system, each transaction that is analyzed must be entered by hand into the appropriate journal and
    12·2 answers
  • List 5 different programming languages calls to print
    8·2 answers
  • ___________ is a computer processor which incorporates the functions of a computer's central processing unit (CPU) on a single i
    15·2 answers
  • Of the measures of feasibility in the accompanying figure, ____ considers points such as "Does the proposed platform have suffic
    8·1 answer
  • knowledge contributes vitally to the development of __________ memory, or recollections of personally experienced events that oc
    12·1 answer
  • if a second system failure occurs while the first recovery is in progress, what needs tobe done after the system recovers for th
    11·1 answer
  • In French class, Blue puts on a visor and the environment changes to that of a café in Paris. Which of the following terms descr
    12·2 answers
  • Which of these five are Netflix Originals?1/5
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!