Python | The School of Code

Settings

Appearance

Choose a typography theme that suits your style

Python

Learn Python for data science and backend development.

1

Hello World

Python uses print() to output text. It’s one of the simplest and most readable languages.

Example

Run this example to see how it works and then try the exercise.

example.py
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Print "Hello, World!" using the print() function

main.py
Loading...
Output
Click "Run" to execute your code...
Quiz

Which function prints output in Python?

SUMMARY

In this section, you learned how to print output to the console. Next, you'll learn how to declare variables and work with different data types.

2

Variables and Types

Python infers types automatically. No need to declare types explicitly!

Example

Run this example to see how it works and then try the exercise.

example.py
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Create variables: name (string), age (int), is_learning (bool)

main.py
Loading...
Output
Click "Run" to execute your code...
Quiz

How do you check the type of a variable in Python?

SUMMARY

In this section, you learned how to declare variables and work with different data types. Next, you'll learn how to format strings using f-strings.

3

String Formatting

Python offers multiple ways to format strings. F-strings (Python 3.6+) are the most modern and readable.

Example

Run this example to see how it works and then try the exercise.

example.py
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Use an f-string to print "Welcome, Pythonista!"

main.py
Loading...
Output
Click "Run" to execute your code...
Quiz

What prefix is used for f-strings in Python?

SUMMARY

In this section, you learned how to format strings using f-strings. Next, you'll learn how to perform mathematical operations.

Unlock 10 More Lessons

You've completed the free preview! Upgrade to Pro to access all 12 lessons in this course, plus advanced projects and certificates.

Locked lessons:
  • Arithmetic Operations
  • Conditionals
  • For Loops
  • While Loops
  • Functions
  • Lists
  • Dictionaries
  • List Comprehensions
  • Final Project: Student Grade Manager
Hello World 1
Variables and Types 2
String Formatting 3
Unlock 10 more lessons Access all content with Pro
Upgrade
Arithmetic Operations 4 Conditionals 5 For Loops 6 While Loops 7 Functions 8 Lists 9 Dictionaries 10 List Comprehensions 11 Final Project: Student Grade Manager 12

Reset Progress?

Are you sure you want to reset all progress for this course? This action cannot be undone.