Category Archives: Pyhton

Python 2

8) Some more things to know about strings are the multiple ways of escaping double quotes in a string such as the /n character.

/n = put’s text after it on a new line

/t = tab’s in the following text on the same line

\\ = add’s in \ into the string

“”” = multiple lines of a string

* = creates a list



A great guide to help start up with python.

1) print (“this is a string”)

It will print to the Python Shell or if you want to run in in the terminal you can by typing in: python followed by the file name. (Make sure your in the right directory).

Any errors in your code will be brought to your attention by the terminal when you run your script and it will also print the line the error is on.


2) Commenting out on python is just like any other programming language and uses a # to comment out single lines.


  • + plus
  • - minus
  • / slash
  • * asterisk
  • % percent
  • < less-than
  • > greater-than
  • <= less-than-equal
  • >= greater-than-equal

To do maths or equations with python, you can write in the numbers and use the expressions above.

4) Variables in python are the same as any other programming language and are set above the code for global use.  Multiple word variables can be written with _.

Also an = is an assigning expression assigns the value on the right to the variable on the left, eg, car = 5.

5) Format strings, these are like normal strings but have variables embedded into them. To use a format string you have to use “string” rather then the ‘string’ , and to write one in the program you”

“string here” % variable name

The % is a module key which add’s in variables to the line.

6) Strings and text, this section describes how we can use combine strings””, variables, numbers and operations all together for example:

hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"

print joke_evaluation % hilarious

This would print “Isnt that joke so funny False”

7) “text\ntext\n”

This will output text into a new line /n stands for newline character

Another extra to strings is the :

There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.

Python 3

Something I should have started learning a long time ago is python, and now this project is starting to enter python territory it seems like the best time to learn it.

There is a massive difference between Python 2 and Python 3 in terms of the syntax used: