IT 116: Introduction to Scripting
Homework 4
Due
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.
Setup
All work for this assignment must be done on users3.cs.umb.edu.
The hw4.py file must be created in an hw4 directory, inside your
hw directory, inside your it116 directory.
From your home directory go to your it116 directory
cd it116
Go to your hwdirectory
cd hw
Create an hw4 directory
mkdir hw4
Enter this new directory
cd hw4
Create the file hw4.sh
nano 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 in this course.
You will find the ranges for each of the letter grades
here.
You should use a single if statement for this assignment.
Your if
statement should not print anything, but
should set a variable that is used in a final print statement
at the end of the program.
Suggestions
Write this script in stages, testing your script at each step
- 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-.
Test the code and fix any errors.
- Add code for B+ and B-.
Test the code and fix any errors.
- Add code for C+ and C-.
Test the code and fix any errors.
- Add code for D+ and D-.
Test the code and fix any errors.
Testing
Your output should look something like this
$ python3 hw4.py
What is your score? 100
The grade for a score of 100 is A
$ python3 hw4.py
What is your score? 92
The grade for a score of 92 is A-
$ python3 hw4.py
What is your score? 89
The grade for a score of 89 is B+
$ python3 hw4.py
What is your score? 85
The grade for a score of 85 is B
$ python3 hw4.py
What is your score? 82
The grade for a score of 82 is B-
$ python3 hw4.py
What is your score? 79
The grade for a score of 79 is C+
$ python3 hw4.py
What is your score? 75
The grade for a score of 75 is C
$ python3 hw4.py
What is your score? 72
The grade for a score of 72 is C-
$ python3 hw4.py
What is your score? 69
The grade for a score of 69 is D+
$ python3 hw4.py
What is your score? 65
The grade for a score of 65 is D
$ python3 hw4.py
What is your score? 62
The grade for a score of 62 is D-
$ python3 hw4.py
What is your score? 59
The grade for a score of 59 is F
The text colored blue is user input.
Be sure to test your script for all the values you see above
since I will use all of them in testing your script.
Be sure to run this script on the Unix machine so you know it works
in the environment in which I will run it when I score your homework.