

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Build an Asteroids Game
incomplete
2: Installation
incomplete
3: Pygame
incomplete
4: Reading the Docs
incomplete
This lesson's interactive features are locked, please to keep using them
Now that we have pygame installed, let's write just a bit of boilerplate code so that we have a runnable program to build on.
import pygame
print(f"Starting Asteroids with pygame version: {pygame.version.ver}")
Keep the __name__ == "__main__" codeblock at the bottom of the file. This line ensures that the main function is called only when this file is run directly; it won't run if it's imported as a module. It's considered the "Pythonic" way to structure an executable program in Python.
Submit the CLI tests using the Boot.dev CLI. There's no penalty on failure for this lesson.