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
Computer Networks - Queues
lyudmila [28]

Answer:

the average arrival rate \lambda in units of packets/second is 15.24 kbps

the average number of packets w waiting to be serviced in the buffer is 762 bits

Explanation:

Given that:

A single channel with a capacity of 64 kbps.

Average packet waiting time T_w in the buffer = 0.05 second

Average number of packets in residence = 1 packet

Average packet length r = 1000 bits

What are the average arrival rate \lambda in units of packets/second and the average number of packets w waiting to be serviced in the buffer?

The Conservation of Time and Messages ;

E(R) = E(W) + ρ

r = w + ρ

Using Little law ;

r = λ × T_r

w =  λ × T_w

r /  λ = w / λ  +  ρ / λ

T_r =T_w + 1 / μ

T_r = T_w +T_s

where ;

ρ = utilisation fraction of time facility

r = mean number of item in the system waiting to be served

w = mean number of packet waiting to be served

λ = mean number of arrival per second

T_r =mean time an item spent in the system

T_w = mean waiting time

μ = traffic intensity

T_s = mean service time for each arrival

the average arrival rate \lambda in units of packets/second; we have the following.

First let's determine the serving time T_s

the serving time T_s  = \dfrac{1000}{64*1000}

= 0.015625

now; the mean time an item spent in the system T_r = T_w +T_s

where;

T_w = 0.05    (i.e the average packet waiting time)

T_s = 0.015625

T_r =  0.05 + 0.015625

T_r =  0.065625

However; the  mean number of arrival per second λ is;

r = λ × T_r

λ = r /  T_r

λ = 1000 / 0.065625

λ = 15238.09524 bps

λ ≅ 15.24 kbps

Thus;  the average arrival rate \lambda in units of packets/second is 15.24 kbps

b) Determine the average number of packets w waiting to be serviced in the buffer.

mean number of packets  w waiting to be served is calculated using the formula

w =  λ × T_w

where;

T_w = 0.05

w = 15238.09524 × 0.05

w = 761.904762

w ≅ 762 bits

Thus; the average number of packets w waiting to be serviced in the buffer is 762 bits

4 0
3 years ago
Describe at least one reason why transitioning from the Cisco implementation of STP to the Cisco implementation of RSTP is seaml
kherson [118]

Answer:

STP mainly uses 5 states in a network, in which some states are replaced in RSTP which improves the time efficiency.

Explanation:

STP mainly uses five states i.e.  Learning, Listening, Blocking, Disabling and Forwarding to overcome the problem of collision in a network.  

RSTP replaced the three states of STP i.e listening, learning, and blocking by Discarding, which results in the time efficiency as compared to STP.  

As STP takes minutes to complete the network inter connectivity, RSTP completes it in seconds.

This is one of the main reason why an administrator want to change to RSTP.

6 0
3 years ago
Algorithm and flowchart:- calculate d=a+b-c​
Keith_Richards [23]

Answer:

a=c

hope it helps

4 0
3 years ago
Which of the following methods is a static method? The class in which the method is defined is given in parentheses following th
maw [93]

Answer:

C. sqrt(Math)

Explanation:

All but one of options A to E are is not a static method.

Only option C is a static method. The sqrt() is a static method of Math, that can always be used as Math.sqrt() is used;

The Math class defines all of its methods to be static. Invoking Math methods is done by using Math as a method rather than a variable of type Math; this means that sqrt(Math) doesn't rely on instance variables and don't need to be overridden, unlike others.

Lastly, sqrt(Math) is a static method because unlike other options, it is an utility method, and it is relevant to computations on primitive data types.

The purpose of the static method is in large part to offer a standard library of functions, and it doesn't need to be applied directly to an object.

4 0
3 years ago
10. Select the correct answer.
Aleks [24]
B) licensing because they are giving Thomas permission to use the images
6 0
3 years ago
Read 2 more answers
Other questions:
  • Write the name of the tab, the command group, and the icon that you need to use to justify text
    9·1 answer
  • What are the different ways one can adjust their communication in order to decrease noise?
    9·2 answers
  • What is the output of the following function call? //function body int factorial(int n) { int product=0; while(n > 0) { produ
    12·1 answer
  • A user reports network resources can no longer be accessed. The PC reports a link but will only accept static IP addresses. The
    6·1 answer
  • what will allow you to immediately exit the program without rebooting the computer, when you realize your browser is not respond
    7·1 answer
  • The Python language uses a compiler which is a program that both translates and executes the instructions in a high-level langua
    15·1 answer
  • I need to reverse a inputted word using for loops with range 0 to the input word and increment 1.
    5·1 answer
  • What is keyboard? answer me <br>​
    12·2 answers
  • Which of the following is an object-oriented language?
    11·1 answer
  • For any element in keysList with a value smaller than 40, print the corresponding value in itemsList, followed by a comma (no sp
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!