Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a python problem and make sure there's no difference between the example and your answer before submitting answers. The eventual goal of this

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

This is a python problem and make sure there's no difference between the example and your answer before submitting answers.

The eventual goal of this assignment is to compute the total number of ways of forming a collection of committees from an academic department of n professors The first task is to write a function called committee to compute the number of ways of forming a single committee with r members from a collection of n people. This is the same as computing the number of ways of choosing r people out of n to sit at the first of two tables, and is therefore n! (r!*(n-r)!) by the reasoning given in the zyLab in section 6.18 on seating a large group at multiple tables. Make sure the function returns an integer, not a floating point number with a decimal point In addition to the fact that this must now be a function, there there are now some further enhancements First of all, there committee membership, so there are r n! need a chairperson If so, there are r choices for the a chaired committee. Another way of ways of of the possible the for selecting is the potential that the chairperson each forming such committee of might (r! (n-r)!) ways thinking how to form such a committee is to choose the chairperson first (there are n possible choices for that), and then for each possible chairperson n-r, this gives the same final formula n! (r-1)! (n-r)!) Your function definition must be of a form like def committee (people, members, chairperson where the parameter "people" is an integer giving the number of people to choose from (called "n" in the formulas above), the parameter "members" is an integer giving the number of members in the committee (called "r in the formulas above) and the parameter "chairperson" is a boolean variable which is True if a chairperson is required, and the formula in the third paragraph of this specification must be used, and False if the committee has no chairperson, and the formula in the second paragraph must be used. You must use exactly these names for the parameters, because your function will be be called by keyword arguments using these parameter names in some of the tests, instead of just relying on the parameter order. Write your function in a file named committee.py, and upload it to zyBooks for the first few tests, which will exercise as it as a module using programs already at zyBooks that import your committee function from it. The first test is with the following calls from committee import committee committee (10, 3, True committee (10, 3, alse committee (members 3, people 10, chairperson True) committee (chairperson False embers 3, people 10) committee (2, 2, True committee (3, 3, False and the six values returned should be 360, 120, 360, 120, 2, 1 respectively. Ifthey are not all correct, zyBooks will report True for the correct ones, and False for the incorrect ones. For now, you may submit an empty file for the file multiple committees.py which will be required for later steps

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions