Code

Recommended Web IDE for Python: pythonanywhere

Embedded code below is hosted by pythonfiddle

**Notes:

  • pythonanywhere lets you select which Python version to use

    • we use 3.2 in class

  • pythonfiddle uses Python v.2.7.

    • Here are a few notable differences between 2.x and 3.x:

Python 3

Python 2

    • use print function with parentheses:

      • print( "Hello world" )

    • use input function to get input:

      • x = input()

    • use print without parentheses

      • print "Hello world"

    • use raw_input function to get input:

      • x = raw_input()

How to display this pythonfiddle gadget in Google Chrome:

    • reload,

    • click the shield icon on the right-hand side of the address bar

    • choose 'load anyway'