Lab 1.03 - Printing & Variables
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
- Type and run the following code.
What happens? How would you make the program print out "cats are really cool" instead?animal = "dogs" print(animal + " are really cool.")
- Type and run the following code.
What output does this produce? Why does this happen?print(dogs + " are cool.")
- Rewrite the following SNAP! program in Python:
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!