IT 116: Introduction to Scripting
Class 2 Exercise
Practice with interactive mode
Run IDLE on your machine
Create some variables
a = 5
b = 6
c = 10
Check the values you have just entered
a
b
c
Perform some arithmetic
a + b + c
a * b + c
a * b * c
a * b / c
Print some phrases
print("Hello world!")
print("Go Red Sox!")
Script for this exercise
Open a text editor
Use the editor built into IDLE.
From the File menu, click and drag down to New File.
Enter the text below
print("Hello world!")
Save the file as ex2.py
Run the script
In the Run menu select Run Module
You should see
Hello world!
Copy the file to Unix
Open FileZilla and connect to
pe15.cs.umb.edu
You will have to connect using your Unix username and password.
Go to your 116 directory
Inside this directory create the directories ex
and hw
Right-click in the whitespace inside the
it116 directory.
Click and drag down to Create directory.
Add ex to the path in the dialog box.
Click OK.
Reapeat this procedure to create an hw
directory.
Go to your ex directory
Inside this directory create the directory ex2
Right-click in the whitespace inside the
ex directory.
Click and drag down to Create directory.
Add ex2 to the path in the dialog box.
Click OK.
Copy your script to pe15
Click and drag your ex2.py file to the
ex2 directory
Running my test script on your script (Optional)
If you want to run my text script on your Class Exercise script do the following
Connect to pe15.cs.umb.edu
Use an ssh client.
Run my test code on your script
~ghoffman/it116_test/ex02.sh
The script will prompt you for your Unix username.