Over the next few weeks I will be creating a very simple run through of all of the basics of Python by using the excellent learnpython.org website. By going through one page at a time and documenting everything, I aim to refresh and consolidate any knowledge I have previously gained and perhaps even pick up something new. Starting with the Basics, this week we have the inevitable ‘Hello World’ script.
#An Introduction to Python with learnpython.org
print("This line will be printed.")
print("Hello, World!)
#Indentation Example
x = 1
if x == 1:
# indented four spaces
print("x is 1.")
#Will Print Nothing
x = 1
if x == 2:
# indented four spaces
print("x is 1.")
#Additional
x = 9
if x == 8:
print("This is 8.")
if x == 9:
print("This is 9.")
The next post will be on ‘Variables and Types’.