Learning Python, Tutorial 6: User Input

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

Learning Python, Tutorial 5: Random Things

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

Learning Python, Tutorial 4: Simple Numbers

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…

Continue reading

Learning Python, Tutorial 3: Playing with Strings

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

Learning Python, Tutorial 2: Hello World and Beyond

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

Learning Python, Tutorial 1: Install Python

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

Bitcoin Hands On Course Lesson 3 – Restore the Bitcoin Wallet

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

How to restore the Primecoin XPM wallet

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