IT 116: Introduction to Scripting
Homework 2
Due
Sunday, September 14th at 11:59 PM
What You Need to Do
- Create the script hw2.py
- Make sure it obeys the rules in
Rules for Homework Scripts
- Move it to an an hw2
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 hw2.py
Specification
- Write a script that ask the user 5 questions
- The script should store the answers for each question
in a variable with an appropriate name
- It should then print a label and the value of the
variable
- Each label and value must appear on the same line
- The script should ask for
- Name
- Birth Year
- Birth Month
- Birth City
- Favorite Color
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
input
statement that asks the user for their
name and stores it in the variable name.
Print "Name" and the value of name.
-
Repeat the step above for "Birth Year" and the variable
year.
-
Repeat the step above for "Birth Month" and the variable
month.
-
Repeat the step above for "Birth City" and the variable
city.
-
Repeat the step above for "Favorite Color" and the variable
color.
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 hw2 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.