What you will learn
- Define and identify: script, print, run, output, variable
- Write a simple script and run it in the IDE
- Print values out to the console (both composed values and from variables)
- Compare script mode vs interactive mode
- Know how to store a value into a variable
Reading
Do Now
Open and save a new project called DoNow103 in the IDE. Run a program by clicking the “>” Run button. See the instructions below for how to open, save, and run a file in the online IDE.
Practice typing the following expressions in the editor and running the code.
Expression 1
2 * 3 * 5
Expression 2
"abc"
Expression 3
"abc" + "bde"
Now try typing the statement below into the file. Save and run the code
print(2*3*5)
Write down the result. Explain what print does. Try printing out 3 different values.
SNAP Flashback – Print Command

How to open, save, and run a file
-
Open a Python 3 project:

- Repl.it autosaves projects
-
Run the program

Lab
Part 1 - Printing Practice
Practice typing out some statements in the editor part of the IDE, then hit “Run” at the top of the screen:
| Expression | Expected Output | Did anything unexpected happen? |
|---|---|---|
print("1") |
||
print(1) |
||
print(1 + 2) |
||
print("1" + "2") |
||
print("this" + " " + "is" + " " + "a" + " " + "sentence" + ".") |
SNAP Flashback - Print Comparison


Part 2 - Variables Practice
1. In your Console
Type and run the following
animal = "dogs"
print(animal + " are really cool.")
In your Notebook
Respond to the following
- What happens?
- How would you make the program print out “cats are really cool” instead?
2. In your Console
Type and run the following code
print(dogs + " are cool.")
Continue In your Notebook
Respond to the following questions
- What output does this produce?
- Why does this happen?
3. In your Console
Rewrite the following Snap! Program in Python

Part 3 - Four Fours
The four fours challenge
Using four 4’s and any operations, try to write equations that have the numbers from 0 to 4 as the answer. You should use Python’s arithmetic operations:
- + addition
- - subtraction or negation
- * multiplication
- / division
- ( ) parentheses for grouping
- ** power
You may also use 44 or 4.4, which count as two fours, or .4, which counts as one four. For example, one solution for zero is:
print("Zero is", 44-44)
Can you find a different solution?
Here are what the results, but not the source code, will look like. (Note: answers may have trailing zeros if floating point arithmetic is used which is fine, i.e. 1 may be displayed as 1.0)
Zero is 0
One is 1
Two is 2
Three is 3
Four is 4
Bonus
Print the output below, but only using one line of code. Feel free to use online resources.
Wow!
This is on a new line!
Bonus 2
Can you find four fours for 5 to 10?
Check your understanding
Pick an answer for each question. You can try again until you get it right.
1. What does print(2 * 3 * 5) display?
- 2 * 3 * 5
- 30
- 10
- Nothing, it causes an error
Python evaluates the expression first, then print shows the result: 30.
2. After animal = "dogs", what is animal called?
- A string
- A function
- A variable
A name that stores a value is a variable. (The value "dogs" is a string.)