In [ ]:
print "123" # print("123")

In [ ]:
def myFunc():
    print('in myFunc')

In [ ]:
myFunc()

In [ ]:
myFunc

In [ ]:
def fib(n):    # write Fibonacci series up to n
     """Print a Fibonacci series up to n."""
     a, b = 0, 1
     while a < n:
         print a,
         a, b = b, a+b

In [ ]:
fib(5)

In [ ]:
bar()

In [ ]:
def bar():
    print('this is bar')
    
def foo():
    print('this is foo')
    bar()

In [ ]:
bar()

In [ ]:
foo()

In [ ]:
def foo1():
    print('this is foo1')
    bar1()
    
def bar1():
    print('this is bar1')

In [ ]:
bar1()

In [ ]:
foo1()

In [ ]:
foo2 = foo1

In [ ]:
foo2()

In [ ]:
def fib2(n): # return Fibonacci series up to n
     """Return a list containing the Fibonacci series up to n."""
     result = []
     a, b = 0, 1
     while a < n:
         result.append(a)    # see below
         a, b = b, a+b
     return result

In [ ]:
fib(4)

In [ ]:
fib2(4)

In [ ]:
refib = fib(4)
refib2 = fib2(4)
print(refib, type(refib))
print(refib2, type(refib2))

In [ ]:
def bar():
    print('in bar')
    return None

def foo():
    print('in foo')
    return

In [ ]:
b = bar()
f = foo()
print(b == f)
print(b, type(b))
print(f, type(f))

In [ ]:
def bar():
    '''this is bar'''
    print('in bar')
    
def foo():
    """this is foo"""
    print('in foo')

In [ ]:
bar()
foo()
print(bar.__doc__)

In [ ]:
# --------------------------------------------------------------------------------  
# Copyright (c) 2013 - 2014 Mack Stone. All rights reserved.  
#   
# Permission is hereby granted, free of charge, to any person obtaining a copy  
# of this software and associated documentation files (the "Software"), to deal  
# in the Software without restriction, including without limitation the rights  
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
# copies of the Software, and to permit persons to whom the Software is  
# furnished to do so, subject to the following conditions:  
#   
# The above copyright notice and this permission notice shall be included in  
# all copies or substantial portions of the Software.  
#   
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
# THE SOFTWARE.  
# --------------------------------------------------------------------------------