Hello, Python
A program is a list of instructions the computer follows from top to bottom, one line at a time.
The first instruction everyone learns is print(). Whatever you put between the parentheses shows up in the output.
print("Hello!") print("Each print starts a new line")
Text goes inside quotes. Python calls a piece of text a string. Single and double quotes both work: 'Hello' and "Hello". Use the other kind around text containing a quote: 'Ask for "Mia"' or "Don't forget ID".
print.See it run
print("Good morning") print("Good", "morning") print("It's", 3, "o'clock")
Each print draws one line in the Output. Watch what happens to the quote marks.
Practice hello, python
Exercise 1
Print exactly two lines:
Hello, Python!I am learning to code.
Exercise 2
A café needs a door sign. Print Open at 8 and Closed on Sunday on separate lines.
Exercise 3
Print a three-line parcel notice: Parcel ready, Ask for "Mia", then Don't forget ID. Keep the quote marks shown around Mia.
Free lesson: use the editor to practice it.
Practice
Loading Python…Visualizer Watch your code run line by line
Run your code, then choose Play to follow its execution.