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
Rama09 [41]
3 years ago
7

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

re's enough space in the array to double the size. Suppose a list stores the values [1, 3, 2, 7]. After calling list.doubleUp(), the list should store the values [1, 1, 3, 3, 2, 2, 7, 7].
Computers and Technology
1 answer:
Maslowich3 years ago
4 0

Answer:

The solution in Python is as follows:

class myClass:

     def doubleUp(self,myList):

           myList[:0] = myList[::2] = myList[1::2] = myList[:]

       

mylist =  [1, 3, 2, 7]

list = myClass()

list.doubleUp(mylist)

print(mylist)

Explanation:

To create a method in Python, the first step is to create a Class.

This is done in the following line:

class myClass:

Then this line defines the method

     def doubleUp(self,myList):

This line duplicates the elements of the list

           myList[:0] = myList[::2] = myList[1::2] = myList[:]

This defines the list        

mylist =  [1, 3, 2, 7]

This creates an instance of the class

list = myClass()

This passes the list to the doubleUp method

list.doubleUp(mylist)

This prints the duplicated list

print(mylist)

You might be interested in
Just five types of pointing device,list
posledela

Answer:

five types of pointing devices

Explanation:

Ponting devices

Pointing means point something and the pointing devices are the input /peripheral devices those are used to point the pointer on the screen. We do move cursor on the screen to open the files or any icon.

There are many types of pointing devices but these are quite common which are given below

  1. Computer mouse
  2. Finger on touch screen.
  3. Joystick.
  4. Leap Motion.
  5. Light pen (pen)

1.Mouse

Mouse is most common type of input device that is used for pointing the data on the screen. We press it with our hands and keep pointing the things.

There are three types of mouse

  1. optical mouse
  2. wireless mouse
  3. trackball mouse.

2. Finger on touch screen

In this type of movement the fingers are input devices those we use to see the movement of pointer on the screen and this is most common in this century.

3.Joystick.

Joystick is another input device to point the cursor but it is mostly used in games. Children can use it smartly so it is inculcated in games usually.

4. Leap Motion

The Leap Motion (LM) controller is a latest 3D sensing device for hand posture interaction with a computer. It is having the capability sense the location of the fingers of the hands, as well as the palm position.

5.Light Pen

this is another pointing device which is mostly used to highlight and select the data on the screen.

Note: All of these above pointing devices are most common used now a days. These devices are having new  conventions day by day for the ease of user. This era is basically the era of IT ,so the use of computer must be so easy and conventional for the user so, the innovations and improvement in such devices is made side by side.

3 0
3 years ago
To add slides to a presentation, _____.
Effectus [21]
<span>select the New Slide option from the Insert menu</span>
7 0
4 years ago
Select the true statement about a scanner.
Mandarinka [93]

Answer:

c. It is an input device that enables users to convert hard copies to digital images or text.

Explanation:

An input device can be defined as any device that is typically used for sending data to a computer system.

A scanner can be defined as an input device designed for transferring informations and images from hardcopy (physical) documents to digital computer files. Thus, it's simply an electronic input device that is used to digitally scan or copy data (informations) from a hardcopy document such as photographs, paper files, printed texts etc and then converted to a digital computer file in formats such as png, or jpeg. The scanner is a device which avail users the ability and opportunity to view, edit and transfer hardcopy document on a computer system in soft-copy.

Majority of the scanners used around the world are flatbed scanners and as such have a flat glass surface for scanning documents.

Basically, all scanners are to be used with a device driver software pre-installed on the computer before the configuration of the scanner.

Other types of scanners are drum scanners, contact image sensor (CIS) scanner, CCD scanner, planetary scanner, 3D scanner, Roller scanner etc.

6 0
3 years ago
Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the num
Svetach [21]

Answer:

Logic for a program

Explanation:

//Here ind = index

//declare the number

number ind

number sum

number avg

number SIZE = 20

number num[SIZE] = {0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0}

getReady()

while ind < SIZE

getNumbers()

stop

getReady()

ind = 0

sum = 0

return

getNumbers()

cout<< “Enter a number for position ”, ind

input numbers[ind]

sum = sum + numbers[ind]

ind = ind + 1

return ;

finishUp()

avg = sum/SIZE

ind = 0

while ind < SIZE

output numbers[ind], avg – numbers[index]

ind = ind + 1

return

Modify the program in 2a

number index

number sum

number avg

number actualSize

number SIZE = 10

number number[SIZE] = 0

7 0
3 years ago
Plato I need answers asap will
Alja [10]

Answer:

Thanks for the points  

Explanation:

3 0
3 years ago
Other questions:
  • Select the correct answer.
    8·1 answer
  • What is a good project I can do for Artificial Intelligence? It has to be some type of Technology that covers Artificial Intelli
    14·1 answer
  • What is the value of the variable result after these lines of code are executed?
    5·1 answer
  • Recall that two strings u and v are ANAGRAMS if the letters of one can be rearranged to form the other, or, equivalently, if the
    7·1 answer
  • Climax Medical Technology, a fast-growing global research firm, has accumulated so much client information that conventional dat
    15·1 answer
  • What does a capitalist economy allow people to do?
    11·2 answers
  • Ron is creating building blocks in Word. How can he make the building blocks that he created available?
    8·2 answers
  • TRUE OR FALSE: COMPUTER SCIENCE!
    8·2 answers
  • WILL MARK BRAIN LIST!
    9·2 answers
  • What is a common misconception about Agile and DevOps?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!