We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Pygame

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.

Assignment

  1. import pygame
    
  2. 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.