IT 116: Introduction to Scripting
Homework 5
Due
Sunday, at 11:59 PM
Deliverables
There is one deliverable for this assignment
Make sure the script obeys all the rules specified in the
Script Requirements page.
Specification
Write a program that prints a table of Celsius temperatures from 0 to 20 degrees and
prints the corresponding temperature in Fahrenheit.
This program MUST use a loop.
You MUST use the Python round
function on the Fahrenheit
value so only integer values appear in the tables.
Each column must have a label at the top specifying Celsius and Fahrenheit
and their must be a line between these column labels and the data that
follows.
The first digit in each temperature must line up with the labels
for each temperature so the output forms neat columns.
Script for this assignment
- Open a text editor
A program like PyCharm or Sublime.
Do not use Word or Notepad.
- Save the file as hw5.py
Suggestions
- Write a loop that runs from 0 to 20 and have it print out those values.
These are the Celsius values.
Run the script and fix any errors.
- Add a formula to the loop which converts a Celsius temperature into a Fahrenheit temperature.
Make sure the result is an integer.
Change the print statement so it prints both temperatures.
Run the script and fix any errors.
- Add a tab or use the
format
function to the print statement
so both temperatures will be aligned in vertical columns.
Run the script and fix any errors.
- Add a print statements before the loop that prints the name of the temperatures
and a line of dashes, -.
Run the script and fix any errors.
Testing on Your Machine
Unix Setup
- Log in to users3.cs.umb.edu
You will be in your home directory.
- Go to your it116 directory
cd it116
- Go to your hw directory
cd hw
- Create a directory for this exercise
mkdir hw5
- Check that the directory was created
ls
Copy the file to Unix
- Open FileZilla and connect to
users3.cs.umb.edu
You will have to connect using your Unix username and password.
- Copy the file to the to it116/hw/hw5
Testing the script on Unix