Function Name: doubles Parameters: list of int Returns: list of int Description: Write a function, doubles, that takes a list of integers and finds values in the list that are exactly twice the previous integer in the list. Return a list of integers from the parameter that meet the criteria specified.

Answers

Answer 1

Answer:

def doubles(numbers):

   double_numbers = []

   for i in range(len(numbers)-1):

       if numbers[i+1] == numbers[i] * 2:

           double_numbers.append(numbers[i+1])

   

   return double_numbers

Explanation:

*The code is in Python.

Create a function called doubles that takes one parameter, numbers

Initialize an empty list, double_numbers, to hold the double values in the numbers that are exactly twice the previous integer

Create a for loop that iterates through the numbers

If the value of the integer is exactly twice the previous integer, add the integer to the double_numbers using append function

When the loop is done, return the double_numbers


Related Questions

Using the chores.csv file fat the very bottom; write an awk script to return the average number of minutes required to complete a chore. Your solution must handle an undefined number of chores. zero points will be given to solutions that use a static number in their calculation.
Format floating point numbers to 2 decimal places.
Example output;
Average: 28.12
chores.csv
Chore Name,Assigned to,estimate,done?
Laundry,Chelsey,45,N
Wash Windows,Sam,60,Y
Mop kitchen,Sam,20,N
Clean cookware,Chelsey,30,N
Unload dishwasher,Chelsey,10,N
Dust living room,Chelsey,20,N
Wash the dog,Sam,40,N

Answers

Answer: Provided in the explanation section

Explanation:

According to the question:

Using the chores.csv file fat the very bottom; write an awk script to return the average number of minutes required to complete a chore. Your solution must handle an undefined number of chores. zero points will be given to solutions that use a static number in their calculation.

Format floating point numbers to 2 decimal places.

Example output;

Average: 28.12

chores.csv

Chore Name,Assigned to,estimate,done?

Laundry,Chelsey,45,N

Wash Windows,Sam,60,Y

Mop kitchen,Sam,20,N

Clean cookware,Chelsey,30,N

Unload dishwasher,Chelsey,10,N

Dust living room,Chelsey,20,N

Wash the dog,Sam,40,N

ANSWER:

BEGIN{

FS=","

}

{

if(NR!=1)

sum += $3

}

END{

avg=sum/NR

printf("Average: %.2f ", avg)

}' ./chores.csv

cheers i hope this helped !!

Which type of appliance can host several functions, such as antimalware, firewall, content filter, and proxy server

Answers

Answer:

Web Security Appliance (WSA)

Answer:

utm

Explanation:

UnifiedThreat Management (UTM): A security appliance and/or software tool

which contains a combination of any of the following: antivirus/antimalware, firewall,

proxy server, content filtering, spam filtering, intrusion detection system, intrusion

prevention system, and network access control. The more robust the tool, the

higher the number of features available.

Write a script called checkLetter.sh Review Greeting.sh for an example. Use a read statement and ask user to "Enter A, B, or C: "

If user types A, echo "You entered A"
If user types B, echo " You entered B"
If user types C, echo " You entered C"
Use the case structure to test the user’s string.
If user types any letter from lower case ‘a through z’ or upper case ‘D through Z’, echo "You did not enter A, B, or C".

Answers

Answer:

The code is given as below: The input and output is as given for one case.

Explanation:

echo -e "Enter A, B or C : \c" #Printing the line on the screen

read -rN 1 test #read the character in the variable test

echo

case $test in #Setting up the case structure for variable test

[[:lower:]] ) #checking all lower case letters

echo You did not enter A, B or C;;

[D-Z] ) #checking upper case letters from D to Z

echo You did not enter A, B or C;;

A ) #Condition to check A

echo You entered A;;

B ) #Condition to check B

echo You entered B;;

C ) #Condition to check C

echo You entered C;;

esac #Exiting the case structure

For each of the following, write C++ statements that perform the specified task. Assume the unsigned integer array will be located at 1002500 in memory when the array is declared. An unsigned integer occupies four bytes. The data type of unsigned integer is unsigned. Use the constant integer variable size that is initialized to value 5 to represent the size of the array. The very first element of the array is the 0th element.

Answers

Answer:

The answer is given as below.

Explanation

As the complete question is not given, the complete question is found online and is attached here with.

a)

int values[SIZE] = {2,4,6,8,10};

b)

int *aPtr;

c)

for(i=0;i<SIZE;i++)

printf("%d", values[i]);

d)

aPtr=values;

aPtr=&values[0];

e)

for(i=0;i<SIZE;i++)

printf("%d", *(aPtr+i));

f)

for(i=0;i<SIZE;i++)

printf("%d", *(values+i));

g)

for(i=0;i<SIZE;i++)

printf("%d\n", aPtr[i]);

h)

array subscript notation: values[3]

pointer/offset notation: *(values +3)

pointer subscript notation: aPtr[3]

pointer/offset notation: *(aPtr + 3)

i)

1002512 is the address is referenced by aPtr + 3 and 8 is the value stored at that location.

j)

1002500 is the address referenced by aPtr -= 2 and 2 is stored at that location.

Other Questions
Find the distance between the pair of points: (0,-8) and (0,4) Decide if each statement is a fact or a misconception about the theory of evolution by natural selection. Each leg of a 45-45-90 triangle has a length of 6 units what is the length of its hypotenuse Please help, I need this answer Read the excerpt from "The Lady Maid's Bell." Then he turned his back on me, and went on talking to his wife; and I knew what that meant, too. I was not the kind of morsel he was after. The typhoid had served me well enough in one way: it kept that kind of gentleman at arms-length. What does the narrator mean when she refers to Mr. Brympton as that kind of gentleman? She does not trust Mr. Brympton. She believes Mr. Brympton to be impatient. She thinks Mr. Brympton is too critical. She does not think Mr. Brympton is handsome. Plssss help!What aspect of Montesquieu's thinking about government had the greatest impact on theFounding Fathers' ideas?his ideas about the natural rights of manhis belief that political power should divided among brancheshis emphasis on individual rights and freedomshis preference for governments headed by women A trust fund eels is 6% simple interest divide into its members accounts every month if a member has $5000 in the funds account how much money would be in that account after three months Suppose a simple random sample of size n= 11 is obtained from a population with u = 62 and a = 14.(a) What must be true regarding the distribution of the population in order to use the normal model to compute probabilities regarding the sample me(b) Assuming the normal model can be used, determine P(x < 65.8).(c) Assuming the normal model can be used, determine P(x 2 64.2).Click here to view the standard normal distribution table (page 1).Click here to view the standard normal distribution table (page 2).(a) What must be true regarding the distribution of the population?O A. Since the sample size is large enough, the population distribution does notneed to be normal.B. The population must be normally distributed and the sample size must be large.OC. The population must be normally distributed.OD. There are no requirements on the shape of the distribution of the population. PLZZZZ HLPPPPP MEEEEEEEEwrite the slope intercept inequality for the graph below. if necessary use = Evaluate -31-8+31 whats the answer Which image best represents the particles in liquids Question2 PointsAn object in a fluid will sink if:A. the buoyant force is larger than the weight of the object.B. the buoyant force is larger than the mass of the object.C. the buoyant force is smaller than the weight of the object.D. the buoyant force is smaller than the mass of the object.SUBM Billys Boat Rentals charges a yearly fee of $105 and $9.50 each time a member wants to rent a boat. Lisas Boat Rentals does not charge a yearly fee but charges $14.75 every time a member rents a boat. How many times does a person have to rent a boat for Billys and Lisas to cost the same amount? Why did the Battle of Buxar prove to be the turning point in the history of the Subcontinent? In the United States, which groups are allowed to hold meetings? nonpolitical groups any groups popular groups licensed groups An unfertilized egg cell has six chromosomes. After fertilization, how many chromosomes should the zygote have? A student does an experiment and wants to make a graph comparing various amounts of materials. Which type of graph should the student choose? The school auditorium had a show on Saturday with full capacity. The total collection of the ticket sale was Rs 73500. Each ticket costed rs 50. As 30 people were admitted as special invitees, they did not have to buy the tickets. Find out the seating capacity of the auditorium. Stanford University conducted a study of whether running is healthy for men and women over age 50. During the first eight years of the study, 1.5% of the 451 members of the 50 Plus Fitness Association died. We are interested in the proportion of people over 50 who ran and died in the same eight year period. Construct a 97% confidence interval for the population proportion of people over 50 who ran and died in the same eightyear period.Define the random variable in X and P in words.Which distribution should you use in this problem? Which of the following expressions are equivalent to this expression: 1(0) = ? im lazy and dont wanna do it