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
solniwko [45]
2 years ago
12

Accept total number of participants (B) in class. A group of

Computers and Technology
1 answer:
mestny [16]2 years ago
6 0

The <em>required code</em> written in python 3 which assigns participants to the <em>4 groups</em> based on the instruction given goes thus :

def assign(p):

<em>#initialize a function named assign </em><em>which</em><em> </em><em>takes</em><em> </em><em>in</em><em> </em><em>one</em><em> </em><em>argument</em><em> </em><em>which is</em><em> </em><em>the</em><em> </em><em>number</em><em> </em><em>of</em><em> </em><em>participants</em><em> </em>

if p%2 == 0 :

<em>#checks</em><em> </em><em>if</em><em> </em><em>the</em><em> </em><em>number</em><em> </em><em>of</em><em> </em><em>participants</em><em> </em><em>is</em><em> </em><em>even</em><em> </em>

val = p/4

<em>#divide</em><em> </em><em>the</em><em> </em><em>number</em><em> </em><em>into</em><em> </em><em>4</em><em> </em><em>equal</em><em> </em><em>groups</em><em> </em>

a,b,c,d = (val,val,val,val)

<em>#assign</em><em> </em><em>the</em><em> </em><em>equal</em><em> </em><em>value</em><em> </em><em>to the</em><em> </em><em>group</em><em> </em><em>’</em><em>s</em><em> </em><em>using</em><em> </em><em>tuple</em><em> </em><em>unpacking</em><em> </em>

print('Group A = %d, Group B = %d, Group C = %d, Group D = %d' %(a,b,c,d))

<em>#display</em><em> </em><em>the</em><em> </em><em>grouping</em><em> </em>

else :

<em>#if</em><em> </em><em>it</em><em> </em><em>is</em><em> </em><em>not</em><em> </em><em>even</em><em>,</em><em> </em><em>then</em><em> </em>

val = p//4

<em>#get</em><em> </em><em>the</em><em> </em><em>whole</em><em> </em><em>number</em><em> </em><em>divison</em><em> </em><em>into</em><em> </em><em>4</em><em> </em><em>groups</em><em> </em>

rem = p%4

<em>#get</em><em> </em><em>the</em><em> </em><em>remainder</em><em> </em><em>value</em><em> </em>

a,b,c,d = (val, val, val , val+rem)

<em>#assign</em><em> </em><em>the</em><em> </em><em>whole</em><em> </em><em>number</em><em> </em><em>to</em><em> </em><em>the</em><em> </em><em>first</em><em> </em><em>three</em><em> </em><em>groups</em><em> </em><em>and</em><em> </em><em>the</em><em> </em><em>sum</em><em> </em><em>of</em><em> </em><em>the</em><em> </em><em>whole</em><em> </em><em>number</em><em> </em><em>and</em><em> </em><em>remainder</em><em> </em><em>to</em><em> </em><em>the</em><em> </em><em>fourth</em><em> </em><em>group</em><em> </em>

print('Group A = %d, Group B = %d, Group C = %d, Group D = %d' %(a,b,c,d))

<em>#display</em><em> </em><em>the</em><em> </em><em>allocation</em><em> </em><em>of</em><em> </em><em>participants</em><em> </em>

Therefore, the sample run of the program is attached below.

Learn more :brainly.com/question/24895955

You might be interested in
Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
soldi70 [24.7K]

Answer:

The program written in Python is as follows

Explanation:

4 0
3 years ago
In disc brakes, pads are forced against the of a brake disc​
Arturiano [62]

Answer:

Explanation:

It's the surface the brake pads contact. When you step on the brakes, pressurized brake fluid pushes against the pistons inside the caliper, forcing the brake pads against the rotor. As the brake pads press against both sides of the disc, the friction stops the wheel's rotation.

6 0
2 years ago
Consider the following code:
ycow [4]

Answer:

The num >= 0 test condition is not correct

Explanation:

The line would lead to the printing of "Your entered: " + str(num) repeatedly without stopping.

The while loop checks the condition that the "num" variable is less than zero. This condition will always be true as there is no means of resetting the value after initially inputting the value that is less than zero.

4 0
3 years ago
Your welcome 95 points gg
STatiana [176]

Answer:

tysm :))

Explanation:

have a great day

4 0
3 years ago
Read 2 more answers
Netflix uses ________ analytics to suggest which movies we should watch as well as to develop new content that it is confident w
marusya05 [52]

Answer:

"Predictive analytics" is the correct answer to the given question.

Explanation:

Predictive analysis is the analysis of the data. It is a type of data analytics that gives the future results by analyzing the historical data Some of the examples of predictive analytics are Machine Learning. Netflix is using the technique of Predictive analytics.

Netflix provides the services of entertainment. In Netflix, we watch the movies also it developed the new content.

6 0
3 years ago
Other questions:
  • Where is line-of-sight Internet common?<br> In space<br> Outdoors<br> Inside<br> In businesses
    10·1 answer
  • Complete the paragraph describing characteristics of an audio mixer
    8·2 answers
  • What are two types of formulas in Excel
    13·2 answers
  • Over the last few years, security cameras and other devices have become more common. Some people argue that these measures viola
    14·2 answers
  • What connectors are available for components to be connected externally to the motherboard
    12·2 answers
  • What is copy and paste?
    13·2 answers
  • Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
    14·1 answer
  • Write a function SwapArrayEnds() that swaps the first and last elements of the function's array parameter.
    6·1 answer
  • FoRWarD MaRcH AND hERe We Go MEMbers of the agEncy BaKuGO AHHHHHHHHH-
    10·2 answers
  • Windows is a GUI Operating System, what is the other type?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!