Python conventions (Zen of Python but others for other languages)


#Go ahead try this in your python3/2 console

import this

#Just go to shell enter python3/python2 and paste that

20140709_python_bytes_3-11-1

 

Write easy to read code

 

#Python comes helpful to teach you how to indent your code
#Since it won't run if you don't
#Indent makes it easy to understand nested code
if 1 == 1:
    for i in range(5):
            print ("This is the range of 5")
            for x in range (45):
                if i = 5:
                    print("We are in the range of 5 of the range of 5")
#Of course this is a pretty bad example but i think you get the drill
#With indentation you know what things belongs to where

Useful external sources:

7 ways to write beautiful code

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s