Thursday, 14 May 2015

My First Attempt

The reason that I have started to look at coding is to help me to do something in my spare time that is constructive and to gain a better understanding of computers as well. I was looking for a language to get started on and came across Python as one of best coding languages to get started with. So with that I also bought a Raspberry Pi to keep it separate from my normal computer and due to the fact that I can plug it into the TV which means that I have a bigger screen.

So having plugged my raspberry pi in and getting it up and running I find that I have Python 3 installed on it and that the shell (See picture below) for its use is called IDLE. It looks very scary to start with having never used anything like this before and they seems like a lot of options on the menu bar to use. However I have myself armed with a beginners guide to helping get a grip to understanding it and its a book called Sams Teach Yourself Python Programming for Raspberry Pi in 24 hours written by Richard Blum and Christine Bresnahan. Having this a starting point is extremely helpful as without this I think that I would be lost and I strongly recommend to anyone that is looking to start python to get yourself a book or some on-line support to help get a basic understanding.




Having a little type in the shell brings up an error code of the following :

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    hello
NameError: name 'hello' is not defined

However in order to write within the shell and get a response you have to write in functions in other words you have to tell it what you want it to do but in a technical way for example to say hello you have to put the following in:

Print 'Hello'

This then kicks out the response of Hello from the system upon looking further into this the quotation marks so that the system knows that this is what it is going to produce an output if you miss parts of the quotation mark out it brings it back as an error message so you need to make sure that what you are putting in has a end quotation mark on it. As you might have noticed whatever you enter after them will be repeated out on the line below. You can use either the single or double quotation marks for it to produce an output but you need to make sure that you use one and stick to it as if you start mixing them up then it can be hard to go back and read your script later on when you produce long ones.

This is the end of the first basic steps the next time I'm going to try out variables.