Friday, October 18, 2013

Why everyone should learn a Programming Language & How to learn Python!

I think everyone should learn a programming language.  It teaches the importance of order, of 'proper' order.  It teaches good planning skills.  It teaches discipline.  It teaches self-learning... and IT IS PRACTICAL!    You would be surprised how often it could be helpful for you to know how to program something up real quick!

So, which language should you learn? My opinion: Python!   Specifically Python 2.6.    I will be posting here in my blog a mini-series of how to learn python.  This is part 1 of 4:  Basic Python

Python Basics  "Hello World",  If I am Cool, "Hello World",  Forever "Hello World", 100 "Hello Worlds".


This whole thing should take you no more than 30 minutes....

1.  Download and install python for your MAC or PC:  (just use the installer!)
http://www.python.org/download/releases/2.6/

2. NEVER BE AFRAID TO SEARCH THE DOCUMENTATION!!!!
http://docs.python.org/2.6/index.html

3. Breeze through a few of these Python Training Slides.. (just go through quickly....  you only learn programming by doing... so go do #4 ASAP!)
http://www.slideshare.net/ahmetbulut/programming-with-python-week-1
http://www.slideshare.net/ahmetbulut/programming-with-python-week-2
http://www.slideshare.net/ahmetbulut/programming-with-python-week-3
http://www.slideshare.net/amiable_indian/introduction-to-python
http://www.slideshare.net/amiable_indian/introduction-to-python-part-two

4. Do the following code in a file for practice... and do the homework below.

print "hello world"

a=1
print a
a="b"
print a
b=5
print b
a=b
print a

message="harlan is cool"
cool=True
if cool:
    print message

cool=not cool
if cool:
    print message

cool=not cool
if cool:
    print message

dancer=True
if cool and dancer:
    print message
    

if cool or dancer:
    print message


#while True:
#    print "hello world"

#for i in range(1,101):
    #print i, "hello world"


name=raw_input("what is your name?")
print "hello %s" % name

number=raw_input("how old are you?")
if int(number) < 5:
    print "you are younger than 5"
elif int(number) < 25:
    print "you are younger than 25"
else:
    print "you are older than 25"
    

'''Homework
Due by next week... write a program that prints    ___ is an even number...
   for every number from 1 to 1000.. then asks user to put in any number
      checks if it is even, and if so.. prints  __ is an even number
       if not prints ___ is NOT an even number.
       * bonus points if you handle 0 correctly!
'''

3 comments:

  1. My friend Nate told me about this great site where you can do python tutorials free and easy. Check it out!

    http://pythonmonk.com/

    ReplyDelete
  2. Harlan,

    I'm reading a book called "Mining The Social Web" right now that sets up a virtual machine on any system that then hosts an iPython notebook server to demonstrate the code and make a uniform Python IDE across all readers' machines. The virtual machine also hosts a MongoDB installation for later chapter that gather a ton of data.

    Would any part of this (iPython, especially) be helpful for your education efforts?

    http://miningthesocialweb.com/

    ReplyDelete
  3. Yes, definately, thanks for sharing!
    Harlan

    ReplyDelete

Blog Archive

Followers