Chapter 1a - Printing
Printing Messagesβ
print("Hello World!")
print('Hello World!')
π§ͺ Try it
Mini quiz β printβ
What does this show?
print("Hello")
Pick an answer to see if you are right.
Japanese Emoticons project
Printing numbersβ
print(4 * 3) prints 12, not the text 4*3.
π§ͺ Try it
Challenge: print a productβ
Write product() so it prints the result of 6 * 7 (one number, nothing else).
Special charactersβ
\n starts a new line. \\ prints one backslash.
π§ͺ Try it
Mini quiz β escape charactersβ
Escape characters
1 / 2What does \n do inside a string?
Pick an answer to see if you are right.
Exercisesβ
Activity: Two lines
Write greet() so it prints Hi on the first line and Ada on the second line.
Hi
Ada