IT 116: Introduction to Scripting
Homework 3
Due
Sunday, September 22nd at 11:59 PM
What You Need to Do
- Create the script hw3.py
- Make sure it obeys the rules in
Rules for Homework Scripts
- Move it to an an hw3
directory on pe15.cs.umb.edu
Setup On Your Machine
- Open a text editor.
I would suggest the text editor built into the program IDLE
.
- Save the file as hw3.py
Specification
Output
Suggestions
- Write this script in stages
- Test your script at each step
- Print the steps below
- And check them off as you finish each one
-
Write an assignment statement which asks the user for a temperature
in Fahrenheit and stores it in the variable
fahr.
Convert the value of fahr using
int()
.
Write a print statement to print the value of
fahr.
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 value the of the
temperature in Celsius and assigns it to the variable
celsius.
Use the formula above and the value of the variable
fahr.
Write a print statement to print the rounded 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.
A Celsius value of 4 should give a Fahrenheit value of 39.
If it does not work, fix the problem.
-
Repeat the above steps for the Celsius to Fahrenheit conversion.
Testing on Your Machine
Copy the Script to Unix
- Open FileZilla and connect to
pe15.cs.umb.edu
- Go to your it116 directory
- Go to your hw directory
- Right-click in the whitespace inside the
hw directory
- Enter hw3 in the dialog box
- Click and drag your script from the bottom left panel
to the bottom right panel
Testing the Script on Unix (Optional)
Copyright © 2022 Glenn Hoffman. All rights reserved. May not be reproduced without permission.