Want to create interactive content? It’s easy in Genially!

Get started free

how to build a game!

Amritha Sypereddi

Created on March 18, 2025

Start designing with a free template

Discover more than 1500 professional designs like these:

Transcript

how to build a game!

click to start

a short introduction to python
hey! welcome to intro to coding

Today, we will be learning the basics of computer science, and by the end of this guide, you will (hopefully) have learned how to run your very first Python program. We'll go step by step, from installing Python to writing and executing a simple script. No prior experience? No problem! Just follow along, and by the end, you'll have built a small interactive game. Let's get started! 🚀

Next

Overview

today we'll be following these simple steps! feel free to skip ahead or start from the beginning

2. Setting Up Your Code Editor

3. Writing Your First Python Program

5. Building a Simple Game

4. Running Your Program

1. Installing Python

Start

Start

Start

Start

Start

1. Installing Python

So, based on what kind of OS and computer you have, the installation steps for Python will vary because different operating systems handle software installation and configuration in unique ways. To determine what you have, check if you're using Windows, or Mac and select the corresponding guide.

Mac Os

Windows

2. Setting up the Code Editor

To write Python code, you'll need a text editor or an integrated development environment (IDE). This is an optional step but makes writing code a LOT easier. Here's how to set one up:

click me!

Now you're ready to write Python code!

3. Writing Your First Python Program

Now that you have Python and a code editor set up, let’s write your first Python program!

1. Open VS Code 2. Create a new file and save it as hello_world.py. Make sure the file ends with .py to indicate it's a Python file. 3. Inside the file, type the following code:print("Hello, World!") 4. Save the file ctrl + S or cmd + S

4. Running Your Program

To run your Python program, follow these steps based on your OS:

click me!

With these steps, you should be able to write and run your first Python program on both Windows and Mac!

Ready for a challenge?

Let's go code your first game!

5. Building a Game: Number Guessing Game

Now that you've learned the basics of Python, let’s dive into creating a simple Number Guessing Game! In this game, the computer will randomly pick a number, and you’ll try to guess it. Here's how to build it:

Step 1: Create a New FileOpen VS Code or any text editor. Create a new file and save it as simple_guess_game.py. Step 2: Write the Game CodeCopy and paste this simple code into your file: Step 3: Run the GameOpen Terminal (on Mac) or Command Prompt (on Windows)Navigate to the folder where you saved simple_guess_game.py using the cd command.Run the program:On Mac: 'python3 simple_guess_game.py'On Windows: 'python simple_guess_game.py'Step 5: Play the Game!You’ll have one attempt to guess the number. The program will tell you whether you guessed correctly or not.

code

click me!

ready for a challenge?

Great Job!

Congratulations on creating your first simple Python game! You've learned how to write basic code, work with user input, and use simple conditionals. This is just the beginning of your coding journey!

what next?
  • Experiment with other small projects, like a calculator or a quiz game.
  • Learn about more Python features such as loops, lists, and functions.
  • Explore online tutorials and Python documentation to deepen your understanding.

Python Official Documentation

Codecademy Python Course

W3Schools Python Tutorial

just keep experimenting, and you'll continue to improve your skills.

happy coding!

Guide for Windows

Step 1: Download Python

1. Go to the official Python website. 2. Click Download Python (latest version).

Step 2: Run the Installer

1. Open the downloaded .exe file. 2. Check the box "Add Python to PATH" (important!) 3. Click Install Now and wait for the installation to complete.

Step 3: Verify the Installation
Next Steps: Install a Code Editor (Optional)

1. Open Command Prompt (Press Win + R, type cmd, and hit Enter). 2. Type the following command and press Enter:python --vIf installed correctly, it should display something like:Python 3.x.x

You can write Python code in Notepad, but using an editor like VS Code or IDLE makes things easier.

Guide for Mac

Step 1: Download Python

1. Go to the official Python website. 2. Click Download Python (latest version) for Mac.

Step 2: Run the Installer

1. Open the downloaded .pkg file. 2. Follow the on-screen instructions to install Python.

Step 3: Verify the Installation

1. Open Terminal (Press Command + Space, type Terminal, and hit Enter). 2. Type the following command and press Enter:python3 --versionIf installed correctly, it should display something like:Python 3.x.x

Next Steps: Install a Code Editor (Optional)

You can write Python code in TextEdit, but using an editor like VS Code or IDLE makes things easier.

1. Install VS Code: (my personal favorite)a. Go to VS Code download page.b. Click Download for Windows, run the installer, and follow the instructions.2. Install Python Extension:a. Open VS Code, go to the Extensions tab on the left, search for Python, and click Install on the extension by Microsoft.3. Open a New File:a. Click File > New File, and save it with a .py extension (e.g., my_first_program.py).

Windows

Mac

1. Install VS Code: (my personal favorite)a. Go to VS Code download page.b. Click Download for Mac c. Open the .dmg file after downloading and follow the instructions to install it.2. Install Python Extension:a. Open VS Code, go to the Extensions tab on the left, search for Python, and click Install on the extension by Microsoft.3. Open a New File:a. Click File > New File, and save it with a .py extension (e.g., my_first_program.py).

VS

1. Open Command Prompt (Press Win + R, type cmd, and hit Enter).2. Navigate to the folder where you saved your Python file using the cd command.Example: cd /path/to/your/folder3. Run the program by typing:python hello_world.py4. You should see the output:Hello, World!

Windows

Mac

1. Open Terminal(Press Win + R, type cmd, and hit Enter).2. Navigate to the folder where you saved your Python file using the cd command.Example: cd /path/to/your/folder.3. Run the program by typing:python3 hello_world.py4. You should see the output:Hello, World!

VS

Game COde
Game COde

import random # The computer selects a random number between 1 and 10 number_to_guess = random.randint(1, 10) # Prompt the user to guess a number print("I have selected a number between 1 and 10.") guess = input("Guess the number: ") # Check if the guess is a valid number if not guess.isdigit(): print("Please enter a valid number.") else: guess = int(guess) if guess == number_to_guess: print("Congratulations! You guessed the correct number!") else: print(f"Sorry, the correct number was {number_to_guess}. Better luck next time!")

Step 6: Experiment

  • This is a super simple game, and you can experiment with it by:
  • Changing the range (e.g., 1 to 20).
  • Giving the player multiple guesses.
  • Letting the player know if their guess was too high or too low.
Have fun coding!