IT 116: Introduction to Scripting
Homework 4
Due
Sunday, September 29th at 11:59 PM
What You Need to Do
- Create the script hw4.py
- Make sure it obeys the rules in
Rules for Homework Scripts
- Move it to an an hw4
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 hw4.py
Specification
- This program should prompt the user for a score
- Convert it into an integer
- And print the letter grade for that score
-
You will find the ranges for each of the letter grades
here
- You must use a single
if-elif-else
statement in this script
- If you use mutliple
if
statements you will
lose points
Output
- The output should look something like this
Score? 86
B+
- The text in blue is what the
user enters
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
-
Copy the script grade4.py from Class Notes 7
into the file hw4.py.
Test this file several times giving it different grade values.
Fix any errors you find.
-
Add code for A-.
Use the >= operator.
Test the code and fix any errors.
-
Add code for B+ and B-.
Use the >= operator.
Test the code and fix any errors.
-
Add code for C+ and C-.
Use the >= operator.
Test the code and fix any errors.
-
Add code for D+ and D-.
Use the >= operator.
Test the code and fix any errors.
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 hw4 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)
- Connect to pe15.cs.umb.edu
using an ssh client like putty.exe (Windows)
or ssh (Mac)
- Go to the directory for this exercise
cd it116/hw/hw4
- Run this script
python3 hw4.py
- You should see something like this
Score? 86
B+
- The text in blue is what the
user enters
Copyright © 2022 Glenn Hoffman. All rights reserved. May not be reproduced without permission.