Skip to content
Guest
Learn Python · Course Syllabus Show lessons
Python Basics · 7 min read · Beginner

Variables, Types & f-Strings

Run your first Python 3 program right in the browser, declare clean snake_case variables, and format output with f-strings.

What you'll learn

  • Run real Python 3 code in the browser using print()
  • Work with str, int, float, and bool types
  • Format readable text using f-strings

Python is famous for its clean, readable syntax. You do not need semicolons or curly braces; Python uses indentation and clear keywords.

Core Data Types

  • str: Text inside quotes, like "DevPath"
  • int: Whole numbers, like 42
  • float: Decimal numbers, like 3.14
  • bool: True or False (capitalized in Python!)

Formatting with f-Strings

Prefix a string with f and place expressions inside { ... }:

name = "Ada"
lessons = 6
print(f"Welcome, {name}! You have {lessons} Python lessons.")

Fill-in-the-Blank Exercise

Python f-String Practice

Format the greeting using an f-string and print it.

track = "Python"
("Learning {track} on DevPath!")

Try It Yourself (Real Python 3 in Your Browser)

Click Run Python below. The first run loads the WebAssembly Python runtime; every run after that is instant!

PythonYour First Python Script
Python Output (WebAssembly / Pyodide)

Click Run Python to execute real Python 3 right in your browser.

Check Your Understanding

Score: 0 / 1

1. How are boolean values written in Python?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind