how to install pygame in terminal code example

Example 1: install pygame

python3 -m pip install pygame <<<(mac)>>>
or
python -m pip install pygame <<<(windows)>>>
or
sudo apt install python3-pygame <<<(ubuntu)>>>

Example 2: install pygame

# on your terminal : 
pip install pygame 

# check if pygame run : 
py -m pygame.examples.aliens 
# if a window is open -> pygame is correctly installed

Example 3: intall pygame

python3 -m pip install -U pygame --user
Wha?

Example 4: how to set up pygame

import pygame
import os
import sys
import random
pygame.init()
screen = pygame.display.set_mode((800, 500))

Example 5: installing pygame

try: 
pip install pygame

if doesn't work ;)
try:
pip3 install pygame

Check more about pygame in the link below.