Syllabus Lesson 1 of 239 · Python Foundations
Python Foundations

Hello, Python

Welcome. Python runs your instructions top to bottom, and the friendliest first instruction is print(). It shows a value on the screen.

print("Hello, world!")

Text wrapped in quotes is a string. You can store a string in a variable using =, then reuse it as many times as you like:

name = "Ada"
print(name)        # Ada

An f-string (note the little f right before the opening quote) lets you drop a variable straight into text using {curly braces}:

name = "Ada"
print(f"Hello, {name}!")   # Hello, Ada!

Anything after a # is a comment. Python ignores it. It is just a note to humans reading the code.

Your turn

Create a variable name set to any name you like, then print exactly Hello, <name>! using an f-string.

Spotted a problem in this lesson? Report it

Code · runs in your browser
Output