## IT 116: Introduction to Scripting Class 2 Exercise

### Create a directory for this exercise

• Go to your home directory
`cd`
• Go to your it116 directory
`cd  it116`
• Create an exercise directory
`mkdir  ex`
• Check that the directory was created
`ls`
• Go to your ex directory
`cd ex`
• Make sure you are in your ex directory
`pwd`
If you are not in /home/UNIX_ID/it116/ex, see me.

• Create a directory for this exercise
`mkdir  ex2`
• Check that the directory was created
`ls`
• Go to this new directory
`    cd ex2`

### Practice with interactive mode

• Enter Python interactive mode
`python3`
• Use the `help()` function
`>>> help("topics")`
`>>> help("ASSIGNMENT")`
• Advance through this help entry

Keep hitting Space until you get to the end.
• Quit this help entry

Type q to quit.
• Create some variables
```>>> a = 5
>>> b = 6
>>> c = 10```
• Check the values you have just entered
```>>> a
>>> b
>>> c```
• Perform some arithmetic
```>>> print("a + b + c = ", a + b + c)
>>> print("a * b + c = ", a * b + c)
>>> print("a * b * c = ", a * b * c)
>>> print("a * b / c = ", a * b / c)```
• Print some phrases
```>>> print("Hello world!")
>>> print("Go Red Sox!")```
• Quit interactive mode

Control D

### Practice with scripts

• Create the script ex2.py
You will need to use a Unix text editor to do this.
I would suggest using `nano`. You will find instructions on using `nano` here.
• Enter the following text into the file

• Save the file and quit
• Run this script
`python3  ex2.py`
• You should see
```a + b + c =  21
a * b + c =  40
a * b * c =  300
c - b - a =  -1
a * b / c =  3.0```
• Let me check your script

Come to me so I can check your script.