Home » GeekSpeak » Python – day 1

Python – day 1

As a long time Perl developer, I’ve decided to give the Python language a shot. A lot of people are using it these days, so I figured I’d learn it over the next few weeks and see what all the hub-bub is all about. I use Eclipse as an IDE on Linux, so I downloaded and installed the latest version. Once that was complete, I decided on the PyDev plugin for no other reason then I found it first.

1- install Eclipse Classic (comes with dev environment for Java)
2- run Eclipse
3- a- help/install new software
     b- put the python URL in the box  http://pydev.org/updates
     c- click add
     d- click select all
     e- next/next/  agree to the license / finish
4- now - to use it
    window/open perspective/python

So, at this point I have my development environment set up and I’m ready to rock and roll. I decided to use the official Python Tutorial to learn the language. At first a few things strike me. I don’t need a semicolon “;” at the end of each statement (although if I put one in, Python doesn’t seem to mind), and instead of a curly bracket “{” at the beginning of a control statement, i need a colon “:” instead.

pure anarchy

I also don’t understand why I get different output from these two statements:

a, b = 0, 1
while b < 10:
    #print "a = ", a
    print "b = ", b
    a,b = b,a+b

print

a, b = 0, 1
while b < 10:
    #print "a = ", a
    print "b = ", b
    b= a+b
    a = b  

print

I'm sure it's a simple explanation, but it's 6:30AM and I've been going though this for a few hours already and I'm kind of tired and don't feel like figuring it out right now. I'll come back to it tonight again.

EDIT:
on the suggestion of a friend, I decided to give this a whirl http://www.udacity.com/overview/Course/cs101/CourseRev/apr2012. It's a seven week comp-sci 101 course that teaches Python.

Leave a Reply