Due: March 7, 2012 | Points: 100 |
As for all earlier assignments, please put refinements for all your programs into one file called “refinements.txt” or “refinements.pdf”, and error journal entries for all your programs into one file called “errors.txt” or “errors.pdf”.
Problem 1 asks you to write a function, not a program. You do not need (and in fact should not submit) anything to provide a user interface. When we grade, we will use our own programs to test your function.
Problem 2 requires a program, though, and the extra credit requires both a function and a program.
flatten([2,9,[2,1,13,2],8,[2,6]])should produce the following lists:
flatten([[9,[7,1,13,2],8],[7,6]])
flatten([[9,[7,1,13,2],8],[2,6]])
flatten([['this',['a',['thing'],'a'],'is'],['a','easy']])
[2,9,2,1,13,2,8,2,6](Text, chapter 14, problem 7, modified)
[9,7,1,13,2,8,7,6]
[9,7,1,13,2,8,2,6]
['this','a','thing','a','is','a','easy']
Submit: Please turn in your program in the file “ls1.py”.
Hint: Doing this recursively is considerably easier than any other way.
Write a program that prints a nicely formatted table of windchill values. Rows represent wind speed for 0 to 50 in 5 mph increments, and columns represent temperatures from −20 to +60 in 10-degree increments. Your program must use the above formula to compute the entries in the table.
Submit: Please turn in your program in the file “chill.py”.
ECS 10, Basic Concepts of Computing Winter Quarter 2012 |