Python

Submitted by: 
Introduction: This tutorial is on how to create a simple calculator in Python. The Theory: Here's how the program will be structured: Get the users first number Get the users second number Get the users action Use if statements to perform the calculation Print out the result Getting The Users Numbers: First we want to get the users two numbers to calculate together somehow. We use input...
Submitted by: 
Introduction: This tutorial will be covering how to make a simple rock, paper, scissors game in Python. How It Works: First we get the user choice through input. Then we generate a random number 1 through 3. Convert the random number to rock, paper or scissors. Output the comparison result. Imports: To generate a random computer choice we need to import the random module... import random ; User...
Submitted by: 
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...
Submitted by: 
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...
Submitted by: 
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 ;...
Submitted by: 
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...
Submitted by: 
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...

Pages