Due Thursday, September 23rd, 3:30 PM
Individual (not team) work this week.
>>> multTable() 1 2 3 4 5 6 7 8 9 2 4 6 8 10 12 14 16 18 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 48 54 7 14 21 28 35 42 49 56 63 8 16 24 32 40 48 56 64 72 9 18 27 36 45 54 63 72 81 >>>
>>> getTitle("<html><head><title>Elmer's Wonderful Web</title></head>")
"Elmer's Wonderful Web"
Hint: Make a local copy of the string that is converted to
all lower (or upper) case. Search for the indices of the start and end of the
title using this copy, and then use them to pick the slice of characters in
the argument string that contains the substring to be returned.
>>> numbersToStrings([1, 2, 3.5]) ['1', '2', '3.5']
When you have completed the last exercise above, or 15 minutes before the lab ends, whichever comes first, submit your lab3.py file as lab 3 in Vincent, by carefully following the instructions on the course web's Vincent page, linked in the contents panel on the left.
If you have finished the in-lab portion of an assignment before the end of a lab session you may leave, but you are strongly encouraged to stay and start work on the main portion of the assignment. That way you can get help right away if you need it.
>>> date('091101')
'September 11, 2001'
In this program the indexes for selecting parts of the mmddyy string need not be considered magic numbers if they are part of assignments to well-named variables.
>>> initials('Martin Luther King')
'mlk'
Enter the amount invested each year: 100
Enter the annual interest rate: .05
Enter the number of compounding periods per year: 6
Enter the number of years: 20
period
year 1 2 3 4 5 6
0 100.83 101.67 102.52 103.38 104.24 105.11
1 206.81 208.54 210.28 212.03 213.80 215.58
2 318.21 320.86 323.53 326.23 328.95 331.69
3 435.29 438.91 442.57 446.26 449.98 453.73
4 558.34 562.99 567.69 572.42 577.19 582.00
5 687.68 693.41 699.19 705.02 710.89 716.81
6 823.62 830.49 837.41 844.38 851.42 858.52
7 966.50 974.56 982.68 990.87 999.13 1007.45
8 1116.68 1125.99 1135.37 1144.83 1154.37 1163.99
9 1274.52 1285.14 1295.85 1306.65 1317.54 1328.52
10 1440.43 1452.43 1464.53 1476.74 1489.04 1501.45
11 1614.80 1628.25 1641.82 1655.50 1669.30 1683.21
12 1798.07 1813.06 1828.16 1843.40 1858.76 1874.25
13 1990.70 2007.29 2024.02 2040.89 2057.89 2075.04
14 2193.17 2211.44 2229.87 2248.45 2267.19 2286.09
15 2405.97 2426.02 2446.24 2466.62 2487.18 2507.90
16 2629.64 2651.55 2673.65 2695.93 2718.39 2741.05
17 2864.72 2888.59 2912.66 2936.94 2961.41 2986.09
18 3111.81 3137.74 3163.89 3190.25 3216.84 3243.64
19 3371.51 3399.60 3427.93 3456.50 3485.30 3514.35
>>> ================================ RESTART ================================
>>>
Enter the amount invested each year: 1000
Enter the annual interest rate: .07
Enter the number of compounding periods per year: 4
Enter the number of years: 10
period
year 1 2 3 4
0 1017.50 1035.31 1053.42 1071.86
1 2108.12 2145.01 2182.55 2220.74
2 3277.10 3334.45 3392.81 3452.18
3 4530.09 4609.37 4690.03 4772.11
4 5873.12 5975.90 6080.48 6186.89
5 7312.66 7440.63 7570.84 7703.33
6 8855.64 9010.61 9168.30 9328.74
7 10509.50 10693.41 10880.55 11070.96
8 12282.20 12497.14 12715.84 12938.36
9 14182.29 14430.48 14683.01 14939.96
>>>
Extra credit: define two constants for the width of the year and period columns and use these in the format specifications (which then have to be assembled with string concatenations). This way the formatting of the entire table can be changed by just changing these two constants.
When you are done, submit your final futvalTable.py file as a3 using Vincent. As always, if you cannot finish all of the assignment, be sure to submit, before the due time, a version of your file that does as much as you can get working.