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.
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.
No comments:
Post a Comment