CSC 243 Introduction to Programming

  Homework 8

Due by 5:45pm on Tuesday, November 13


Reading

Read Chapter 10 of the textbook.

Exercises

Solve the following by implementing the corresponding functions in module homework8.py:


5.41, 5.47 (two versions: one using iteration and the other using recursion), 10.14, 10.28, 10.29 (use folder test in test.zip to test your code).

NOTE: in exercise 10.14, the examples are incorrect; the correct examples are

>>> combinations(1, 2)
0              (because there is no way to choose 2 items from a set containing only one item)
>>> combinations(2, 1)
2              (because there are 2 ways to choose 1 item from a set containing two items)
>>> combinations(5, 2)
10              (because there are 10 ways to choose 2 items from a set containing 5 items)
>>>

Please use the discussion forum on COL to discuss this assignment between yourselves and with me. Submit the file homework8.py only through COL.