import profile

print profile.__doc__


## 1.
def sorozat():
    for i in range(1000):
        pass

def main():
    for i in range(2):
        sorozat()

#profile.run('main()')

## 2.
list = [1,2,3]*15

#from quick_sort import qs1
#profile.run('qs1(list)')

#profile.run('list.sort()')

## 3.
def osszeg1():
    ossz = 0
    for i in range(1000):
        ossz += i
    return ossz

#profile.run('print osszeg1()')

def osszeg2():
    return reduce(lambda x, y: x+y, range(1000))

#profile.run('print osszeg2()')

####################
## 4.
## 4.1
def doit1():
    import string             ###### import statement inside function
    string.lower('Python')

def f1():
    for num in range(10000):
        doit1()

## 4.2
def doit():
    string.lower('Python')

def f2():
    import string             ###### import statement outside function
    for num in range(10000):
        doit()

## 4.3
def f3():
    for num in range(10000):
        string.lower('Python')

## 4.4
import string
def f4():
    lower = string.lower         
    for num in range(10000):
        lower('Python')


## profile.run('f1()')
## profile.run('f2()')
## profile.run('f3()')
## profile.run('f4()')
profile.run('f4()')
profile.run('f4()')
