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
777dan777 [17]
3 years ago
5

MyProgramming Lab

Computers and Technology
1 answer:
Akimi4 [234]3 years ago
4 0

Answer:

Explanation:

The following code is written in Python. It creates a method for each one of the questions asked and then tests all three with the same test case which can be seen in the picture attached below.

def alternating_list(lst1, lst2):

   lst3 = []

   for x in range(len(lst1)):

       lst3.append(lst1[x])

       try:

           lst3.append(lst2[x])

       except:

           pass

   if len(lst2) > len(lst1):

       lst3.extend(lst2[len(lst1):])

   return lst3

def reverse_alternating(lst1, lst2):

   lst3 = []

   if len(lst1) == len(lst2):

       for x in range(len(lst1) - 1, -1, -1):

           lst3.append(lst1[x])

           lst3.append(lst2[x])

   return lst3

def alternating_list_no_extra(lst1, lst2):

   lst3 = []

   max = 0

   if len(lst1) > len(lst2):

       max = len(lst2)

   else:

       max = len(lst1)

   for x in range(max):

       lst3.append(lst1[x])

       try:

           lst3.append(lst2[x])

       except:

           pass

   return lst3

You might be interested in
After merging two arrays is complete you need to
VikaD [51]

Answer: C) copy the merged array back to the original array

Explanation:

 After performing merging of two array then, copy the merge array back to its original array. Merging of two array is done by the process of merge sort. Merging of two array is the similar process of concatenate the two array into the single object.

It basically works on the principle of divide and conquer algorithm. It divide the input value into the two half and then, sorted the accordingly. Then after completion of merging the two array it copy into the original array.

5 0
3 years ago
c programming Write code that prints: Ready! countNum ... 2 1 Go! Your code should contain a for loop. Print a newline after eac
olga_2 [115]

Answer:see explanation

Explanation:

Hello, from your question I see that you need a program which based on countNum's value prints ready then all the numbers to 1 and finally go!, I'd appreciate if you provided information about the numbers after the example you gave as I do not know if they are to be printed too.

The solution I provide includes the countdown to 1 printing newline after each number and text. Try it out!

#include <stdio.h>

int main(void)

{

   int countNum;

   int i;

   countNum = 22;

   for ( i = countNum; i > 0; i--) {

       if (i == countNum){

           printf("Ready!\n");

       }

       printf("%d\n",i);

   }

   printf("Go!\n");

   return 0;

}

6 0
3 years ago
How do you optimize a website using JavaScript?
GenaCL600 [577]
You can edit the website (using Wordpress) -if it is your website of course-, and code JavaScript commands into the page that’s going to be uploaded.

Check out my website: www.birdbloggersblog.com

I coded that with HTML.
4 0
3 years ago
Which key toggles between insert mode and overtype mode?
andrew-mc [135]
The keyboard key that toggles between insert mode and overtype mode is the INSERT key.
7 0
3 years ago
PLS HURRY!!<br> Look at the image below
MrRa [10]

Answer:

1. A function can use variables as parameters.

2. A function can have more than one parameter.

3. The definition of a function must come before where the function is used.

Explanation:

<u>The definition of a function can come before or after it is used</u> - I am pretty sure it cannot be placed after the function is being used. It should always come before it is used, so this statement is false.

<u>A function can use variables as parameters</u> - this is true, variables are just labels to hold data.

<u>A function can have more than one parameter</u> - this is true.

<u>A function must have a return value</u> - functions do not always have to <em>return</em> values. It could simply print, so this statement is false.

<u>The definition of a function must come before where the function is used</u> - As said earlier, the definition of functions must come before it is used/called. This statement is true.

Hope this helps :)

7 0
3 years ago
Other questions:
  • 5. Which of the following is a Windows feature that allows you to temporarily store text?
    13·2 answers
  • If you are viewing a webpage with customized or regenerated content, such as updated stock quotes, what type of webpage are you
    14·1 answer
  • Plagiarism occurs when writers
    14·2 answers
  • Graded Assignments may be found at the end of each chapter of the required textbook under the title "Real-World Exercises". Each
    15·1 answer
  • Create a class named Console, and move all the methods that retrieve and validate user input to that class. These methods can re
    7·1 answer
  • The National Institute of Standards and Technology (NIST) guidelines list four different states a mobile device can be in when y
    7·1 answer
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    11·1 answer
  • What are some common uses of Excel?
    10·1 answer
  • Pleaseee help me with the typical situations of the icons(i already know for words but I have no idea for giving the situations
    5·1 answer
  • Assume you have written a method with the header num yourMethod(string name, num code). The method's type is ____ .
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!