In [ ]:
print "Hello, World!"

In [ ]:
adjectives = ['awesome','good','excellent','awful','terrible']
count = 0
for word in adjectives :
    if word[0] == 'a':
        print word
        count += 1
print "Found " + str(count) + " adjectives that start with 'a'"

In [ ]:
x = 10
print type(x)
pi = 3.14159
print type(pi)
y = sqrt(16)
print type(y)

name1 = "Mark"
print type(name1)
name2 = 'Mark'
if name1 == name2 :
    print """They're equal!"""

In [ ]:
adjectives = ['awesome','good','excellent','awful','terrible']
adjectives.insert(3,'nice')
adjectives.append('super')
print adjectives

temperatures = [87, 56, -4, 70, 92, 60, 38, 87, 64, 71]
temperatures.remove(87)
print temperatures
temperatures.sort()
print temperatures

In [ ]:
points = [[3,-1,6,5],[9,12,-7,8]]
print points[1][2]

In [ ]:
squares = [x**2 for x in range(0,10)]
squares

In [ ]:
double = [2*x for x in squares if x%3 != 0]
double

In [ ]:
weekday = ('Mon','Tue','Wed','Thu','Fri')
weekend = ('Sat','Sun')
week = weekend + weekday
for day in week :
    print day
week[1] = 'Sunday'

In [ ]:
range(12)

In [ ]:
range(-10,10)

In [ ]:
for i in range(len(weekday)) :
    print i, weekday[i]

In [ ]:
temperatures = [87, 56, -4, 70, 92, 60, 38, 87, 64, 71]
print "start:end", temperatures[3:6]
print ":end", temperatures[:6]
print "start:", temperatures[6:]
print "all values", temperatures[:]
print "step value", temperatures[0:6:2]

In [ ]:
personal_info = {'Name':'John', 'Age':34, 'Height': 68.4 }
print personal_info['Age']

In [ ]:
personal_info2 = dict(Name='John', Age=34, Height=68.4)
print personal_info == personal_info2

In [ ]:
for i in range(len(week)) :
    if week[i] == 'Fri' :
        print "TGIF!"
    elif week[i] in weekday :
        print "I'm at work"
    else :
        print "It's ",week[i]

In [ ]:
name1 = "John\nSmith"
name2 = 'John\nSmith'
name3 = """John\nSmith"""
print name1 == name2, name2 == name3
print name1

In [ ]:
today = "December " + "25" + ", " + "2014"
print today
x = 'bye ' * 4
print x

In [ ]:
today = "wednesDay"
print today.capitalize(), today.upper(), today.lower(), today.index("nes")

In [ ]:
greeting = "Hello! Welcome to the world of Python programming."
words = greeting.split()
print words

In [ ]:
def printHi(num_of_times) :
    print "Hi" * num_of_times
printHi(7)

In [ ]:
def f(x,y) :
    return x**2 + y**2
print f(2,3), f(-2,4)

In [ ]:
def f2(x,y) :
    return (x**2, y**2)

print f2(2,3), f2(-2,4)

In [ ]:
f3 = lambda x,y : x**2 + y**2 
print f3(2,3)

In [ ]:
greeting = "Hello! Welcome to the world of Python programming."
words = greeting.split()
lengths = map(lambda word : len(word), words)
print lengths

In [ ]:
import numpy
import numpy as np
from numpy import *
from numpy import linalg, ndarray
from numpy import linalg as la, ndarray as nd

In [ ]:
print map(lambda a : 2**a, range(5))

In [ ]:
a = dict(x=5, y=10, z=-3)

In [ ]: