Your First Python Script

Your First Python Script

Written by Dev Dojo on Jun 4th, 2015 Views Report Post

You may have heard of the Python Programming Language and it may even sound kind of intimidating. Do you really want to learn another programming language? Is it going to take a long time to learn Python?

The answer is Yes, and No. Python is very easy to use. In fact you can simply type the following in a plain text editor:

print "Hello Python"

And save it as hello.py then, open up a terminal window and type python hello.py and you'll see a print out of "Hello Python".

It's just that easy. There are of course more complex applications that you can create with Python. Here is a quick example of a for loop in Python:


# Prints out the numbers 0,1,2,3,4
for x in xrange(5): # or range(5)
    print x

Note that in Python there are no curly braces all over the place, instead the code is whitespace sensitive, so the tabs are executed based on the indentation of the code. With big companies like Google, Yahoo, Disney, Nokia, and many others it will show to be beneficial in having a good grasp on the python programming langauge :)

To learn more about Python you may want to checkout this awesome resource: http://www.learnpython.org/ 

Comments (0)