IT 116: Introduction to Scripting
Homework 3
Due
Sunday, February 14th 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
This program must prompt the user for a temperature in Fahrenheit, convert
that temperature to Celsius and print the Celsius temperature.
The Celsius temperature must be an integer.
Then the program must print a blank line.
The program must now prompt the user for a temperature in Celsius, convert
that number to Fahrenheit and print the Fahrenheit temperature.
The Fahrenheit temperature must be an integer
You will find conversion formulae
here
and here.
Script for this assignment
- Open a text editor
A program like PyCharm or Sublime.
Do not use Word or Notepad.
- Save the file as hw3.py
Suggestions
Write this script in stages, testing your script at each step
- Write an assignment statement which asks the user for a temperature in Fahrenheit.
Write a print statement to print out the Fahrenheit value.
Save the file and quit.
Run the script to make sure it works properly.
If it does not work, fix the problem.
- Write an assignment statement that calculates the Celsius temperature using the value of the Fahrenheit temperature.
The left hand side of the assignment statement should be a variable that will hold the Celsius temperature,
while the right hand side is a formula to that calculates the Celsius temperature using the Fahrenheit variable.
Write a print statement to print the Celsius value.
Save the file and quit.
Run the script to make sure it works properly. A Fahrenheit value of 40 should give a Celsius value of 4.
If it does not work, fix the problem.
- Repeat the above steps for the Celsius to Fahrenheit conversion.
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 hw3
- 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/hw3
Testing the script on Unix