$29
ECE-203
Homework Week 2
(20 Points) The formula for converting from degrees Fahrenheit to degrees Celsius is
C =
5
9
(F − 32)
Write a program that prints out a conversion table with degrees Fahrenheit in the first column and
degrees Celsius in the second column. The table should start at 0◦F and end at 100◦F with 10◦
increments. When displayed, decimals should be carried out to two places. Please note that table
formatting (i.e. whitespaces, etc) do not need to be perfect.
Name your program ftoc1.py and save its output as ftoc1.txt. Be sure to submit both files..
• If you need help capturing your program’s output in a text file, please watch the video
HOWTO: Saving Output, which is available under the Tutorials section of the course
website.
• If you need help transferring your program file (ftoc1.py) and its output (ftoc1.txt) to your
local computer for upload to BBLearn, please watch HOWTO: Transferring Files via
SFTP, which is also available under the Tutorials section of the course website.
(10 Points) The conversion from Fahrenheit to Celsius is often approximated as
C ≈ Cˆ =
1
2
(F − 30)
when people perform the conversion mentally or conversationally. Create a new program based
on ftoc1.py that adds a third column containing this approximation as well as a fourth column
containing the error of the approximation (as Cˆ − C). When displayed, decimals should be carried
out to two places.
Name your program ftoc2.py and save its output as ftoc2.txt. Be sure to submit both files.
(20 Points) Write a Python program to compute the following expression:
s =
∑
M
k=1
1
k
Write your program so that the limit of summation M is defined at run time by taking user input
from the keyboard. When writing your program, you may assume that the user will type in only
valid input.
Name your program summation.py and save its output as summation.txt. Be sure to submit
both files.
1
Submitting Your Assignment
Create a zip file with the following structure:
.HW2 abc123.zip
.ftoc1.py
.ftoc2.py
.summation.py
.ftoc1.txt
.ftoc2.txt
.summation.txt
name your zip file using your Drexel user id. For example: HW2 abc123.zip. Upload your zip file
to learn.drexel.edu using the assignment submission link found on the course website.
Points will be deducted for improperly packaged submissions.
2