Skip to main content

Python Tutorial

How to Create a Text Explorer Game in Python

Introduction: This tutorial will cover how to create a simple text based exploration game. How It Works: What we are going to do is; Give the user instructions. Show the current place where the user is within the game. Give the user options. Take them in the direction they enter. Restart loop from step 3. The Instructions: So the first thing we do is give the user instructions on how to play the

How to Create a Tic-Tac-Toe Game in Python

Introduction: This tutorial is going to cover how to create a simple, text based tic-tac-toe (three in a row) game in Python. The Variables: First we need to create some variable that will be used throughout the game. The constants are used to hold the board size, and the character value of each possible state of one field within the board... X = "X"; O = "O"; EMPTY = " "; SIZE = 9; Next we need

How to Create a Guess My Number Game in Python

Introduction: This tutorial is on how to make a guess my number game in Python. The Game: This is a simple game where the computer chooses a random number, then the player has a certain amount of guesses to guess the correct number by following the feedback (too high, or too low). The Imports: First we need to import the random module to let the computer choose a random number... import random

How to Read and Write To/From Files in Python

Introduction: In this tutorial, we are going to be covering handling files in Python. Generic: To read or write from/to a file, we first need to create a stream. To do this we use the Python function 'open' which takes two parameters, the file, and the mode. The file should a file name (including directory location if it is not in the same directory as the current program) as a string, while the

Creating a Simple GUI in Python

Introduction: This tutorial is going to be on how to create a GUI in Python using Tkinter. Tkinter: Tkinter is a basic package to give your projects a simple GUI with the essential GUI elements such as textboxes, checkboxes, buttons and more. Our Program: Our program is going to be a simple program where the user enters text in to a textbox, then clicks a button to get it output to the console