Assignment 1: Working With Python Functions | |
CSE 415: Introduction to Artificial Intelligence The University of Washington, Seattle, Winter 2005 | |
The reading for this assignment is
Chapters 1 and 2
in The Elements of
Artificial Intelligence With Python. Part I of the text (Chapters 1-3) is available
at the Copy Center in the basement of the Communications Building, starting
Tuesday morning, January 4.
| |
Part A. Do exercises 1 through 4 (on page 52
of The Elements of Artificial Intelligence With Python.
Point values: exercise 1 (5 points), exercise 2 (5 points),
exercise 3 (20 points),
exercise 4 (20 points).
Due Friday, January 13 at the beginning of lab. This is should be a printout showing a session with Python. You can use a combination of input and output together with comment lines (beginning with a pound sign) to show that you have verified each of your answers on the computer. | |
Part B:
Write Python function definitions for any two
of the following requirements (worth 25 points each).
1. add_trios([2, 5, 1.5, 100, 3, 8, 1, 1, 1]) -> [8.5, 111, 3] 2. double_nums([1, 'fun', 2, 'words']) -> [2, 'fun', 4, 'words'] 3. consonants_to_x(['r', 'i', 'o', 't', 'e', 'r']) -> ['x', 'i', 'o', 'x', 'e', 'x'] 4. nest_numbers(['a', 'b', 2, 3]) -> ['a', 'b', [2], [3]] | |
Part C: (Optional for 5 points extra credit).
Extend the
sequence recognizer
program so that it can handle
not only sequences of numbers, but also sequences of letters.
For example, it should be able to recognize patterns
in the sequences
['a', 'b', 'c'] ['a', 'b', 'd', 'h', 'p'] ['c', 'b', 'a', 'z', 'y']You may elect to assume that characters correspond to integers in the range 0 to 25, and that counting and addition are performed modulo 26. SolutionsSolutions are now available. |