In this tutorial we’ll be look at loops within Python, specifically the while loop. As usual, you can follow the video, or the text and code below. You can find the code example here: Tutorial 8 – While loops
A loop is simply a bit of code that executes again and again until something happens to break it (picture a circle). It’s probably easier to understand when you see it in action, so open your Python IDLE GUI and we’ll get cracking with an example… Continue reading
In this lesson we are going to revisit the dice rolling we did in Tutorial 5, only this time we are going to get the computer to offer advice based on something other than a random choice. To do that we will make use of the If statement as well as the elif and else parts of it.
It is important to get a grasp of this as it is used everywhere, across all languages. So, grab a coffee sign up to the subscribe box to the right and let’s get started. You can watch the video, or follow the text. Oh, and you can find the code example here: Tutorial 7 -If Elif Else Example
Once you have opened the Python IDLE GUI and started a new file, we’ll get started by importing the random class and rolling the dice. We do that with the following code… Continue reading
At some point in our programs, we will probably want to get some input from a user. Perhaps their name for example, or their favourite number.
Lets have a look at how to ask the user for that input, using the raw_input() function, and what to do with it once we have it. As ever, you can watch the video, or follow along with this post. The source code can be found here: Tutorial 6 -User Input Example.
Begin by opening your Python IDLE GUI and starting a new file.
There are a couple of ways we can get input from our user, but for the moment we are going to concentrate on a function called raw_input(). This function displays a prompt to the user and converts whatever they put into it into a string. Lets see it in action… Continue reading
In this Python tutorial, we are going to be having a look at random numbers and making random choices. As usual, you can follow along with the text on this page, or with the video below.
You can find the source code by here: Tutorial 5-Randon Numbers and Strings Example
Let’s start by opening the Python IDLE GUI and then clicking File\New File
Once you have a new window we will type some code to import the random class like so… Continue reading
I hope you enjoyed the previous tutorial about strings. In this one, one are going to have a look at numbers. Don’t worry, I’ll keep it light and we won’t do anything deep. There is plenty of time for that in later lessons.
As usual, you can follow along with the text, or with the video below. You can grab the code for this tutorial here: Tutorial 4 – Simple Numbers Example.
Open the Python IDLE GUI (see Tutorial 1 if you need to refresh your memory). Now let’s start by typing some simple sums directly into the GUI window. Enter each of the following followed by the Enter key…
2+10 Continue reading
We have already seen how to print strings to the screen in the last tutorial, but there are a few things that could trip you up, so lets have a look at some common ones here.
You can follow along with the post, or watch the video below. The code for the tutorial is available here.
We know that we can use code like:
print "Brian said - Leave me alone" Continue reading
In programming tutorials, it is traditional to start with what is called a hello world program. However, we already did something similar in Tutorial 1 when we printed the result of 10 + 10. Anyway, I already think that you are better than that, so lets try taking it a step further.
You can follow along with the post, or watch the video below. The code example is available here.
First we need to open our IDLE Python GUI, do that by going to Start, All Programs, Python 2.7 and clicking on IDLE (Python GUI). Continue reading
Thanks for joining me on this adventure in learning Python. Before we can get stuck into some coding, we are going to need to get the Python tools set up on our computer.
You can either follow along with the post here, or watch the video below. Whichever method you decide on, please do the installation, because we will be needing it in the next tutorial.
It’s simple and free to install. Start by going to the Python.org download page. Continue reading
In the last lesson we made a backup of the Bitcoin wallet file. Now imagine we have had a disaster and our PC blew-up! As long as we have kept that backup safe, we will now be able to restore it onto our new PC.
Once you have installed a new version of the Bitcoin-qt software on your new PC, this task is nice and easy, just follow the steps below - Continue reading
Finding yourself in a situation where your machine dies and you lose your Primecoin wallet can be stressful to say the least. However, if you have followed the steps I have outlined so far, you will have a good backup of your wallet and you will know how to install a new wallet on your machine when you repair/replace it.
Once you have installed a new copy of the Primecoin wallet, you will need to locate the wallet.dat file and replace it with your backup. To do this follow these steps – Continue reading