Python

How to Create a Simple Calculator in Python

Submitted by Yorkiebar on
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.

How to Create a Rock Paper Scissors Game in Python

Submitted by Yorkiebar on
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...

How to Create a Text Explorer Game in Python

Submitted by Yorkiebar on
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 game...

How to Create a Guess My Number Game in Python

Submitted by Yorkiebar on
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...

How to Read and Write To/From Files in Python

Submitted by Yorkiebar on
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 mode should also be a string. Don't forget to replace any backslashes in the directory with two backslashes to avoid Python escape character problems.

Creating a Simple GUI in Python

Submitted by Yorkiebar on
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.