back to Index
Let's learn about what IPython notebook is!
Each rectangular block is called a cell.
In [3]:
print "Hello, Topgear-User!"
Congratulations. You have run your first python program! Lets do something more interesting.
The function you just learned was print and its purpose is to print out what you put in the quotes.
Try to print out the phrase "TopGear is great!" in the following cell and don't forget to run it:
If you look at the top portion of the window you are on, there is a bar with many useful ac tions represented as buttons. Hover your mouse pointer over these buttons to see what they do!
One very useful button to know just in case your program goes out of control is the stop sign. This will completely halt everything that is happening.
For those who like keyboard shortcuts hit ctrl + m then h.
Now let's get deeper into Python! (Style this line for kids)
In [ ]:
test.
In [ ]:
In [5]:
def Hello(x):
print "hello " + x
In [6]:
Hello("name")
The line that starts with def defines the beginning of a function. Think of functions as machines that only do one thing.
The name of the function is characterized by what is written after def which is Hello in this case.
the x is called a variable. Variables are a way of saving information such as numbers and words.