Reminder: for each class session and associated homework:
|
Do all your work for this homework in the project you checked out in class today:
06-StringsAndLists
Recall that:
def encode(): ''' Asks the user for a message (as a string, input on a single line) to encode and a key (number) with which to ... Then encodes ... ... The function prints ... ''' # Gets the message and key from the user etc
A comma-separated sequence of numbers, e.g.:
184, 181, 188, 188, 191, 112, 196, 184, 181, 194, 181
or the same thing but with the brackets (list notation), e.g.:
[184, 181, 188, 188, 191, 112, 196, 184, 181, 194, 181]
or the same thing as the first form but with spaces (not commas) separating the numbers:
184 181 188 188 191 112 196 184 181 194 181
or the numbers on separate lines with (say) -1 to signal end-of-input
(warning: this approach would require you knowing how to do an IF statement):
184
181
188
etc
181
-1
or something else?
A list of characters, separated by spaces, e.g.:
h e l l o t h e r e
or a string, e.g.:
hello there
or something else?
You will face a number of technical challenges in this problem.
Click here for some comments/hints. |
Often, the generated data is formatted so that another program can automate the process of analyzing, categorizing, and manipulating the data. In this problem you are to write and test a function functionDisplay in module, 4-funcDisplay.py, that implements the following design:
200 + 200 cos(n π / 180)
where n ranges from 0 to num - 1. Make sure the output is neatly formatted so that numbers and decimal points line up.
Below is a sample of some of the MIDDLE PORTION of the expected output when n is 300. Your program's output should match this format exactly.
98 172.165 99 168.713 100 165.270 101 161.838 102 158.418 103 155.010 104 151.616 105 148.236 106 144.873 107 141.526 108 138.197 109 134.886 110 131.596 111 128.326 112 125.079 113 121.854 114 118.653 115 115.476 116 112.326 117 109.202 118 106.106 119 103.038 120 100.000 121 96.992 122 94.016
Do the exercise in the 5-approximatePi.py module of today's project. It asks you to solve a version of exercise 15 on page 78 of your text.
In your 4-funcDisplay.py module write and test a version of the functionDisplay function, called enhancedFunctionDisplay() that prompts the user to enter the function for column 2 instead of hard-coding the function, as is done in functionDisplay.