In [3]:
a, b = 0, 1
while b < 1000:
    print(b,end=',')
    a, b = b, a+b
# new line arranged accoriding to usage frequency


1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,

In [17]:
#this is for pointer and data copy issues
words=['set','me','up','for', 'a', 'win']
words[:]
crowds=words

In [19]:
for i in crowds[:]:
    print(i,len(i))
    crowds.insert(0,i)


set 3
me 2
up 2
for 3
a 1
win 3

In [20]:
crowds


Out[20]:
['win', 'a', 'for', 'up', 'me', 'set', 'set', 'me', 'up', 'for', 'a', 'win']

In [21]:
words


Out[21]:
['win', 'a', 'for', 'up', 'me', 'set', 'set', 'me', 'up', 'for', 'a', 'win']

In [22]:
hurds=crowds

In [23]:
words = ['wow','what','a','coincedence']

In [25]:
hurds


Out[25]:
['win', 'a', 'for', 'up', 'me', 'set', 'set', 'me', 'up', 'for', 'a', 'win']

In [31]:
print(range(0,5,30))


range(0, 5, 30)

In [37]:
testarray=range(0,5,30)

In [38]:
testarray


Out[38]:
range(0, 5, 30)

In [42]:
list(testarray)
list(range(10))


Out[42]:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In [11]:
cnt=0
for g in ['susie','mary','lisa']:
    cnt=cnt+1
    if g =='mary':
        continue
    print(cnt)


1
3

In [56]:
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, end=',')
        a, b = b, a+b
    print()
    return(b-a)

fib(5000)


0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,
Out[56]:
4181

In [57]:
'this' in ['that','this','it']


Out[57]:
True

In [59]:
def listCheck(a, L=None):
    if L is None:
        L = []
    L.append(a)
    return L
listCheck(1,[2,3,4])


Out[59]:
[2, 3, 4, 1]

In [61]:
listCheck(2)


Out[61]:
[2]

In [6]:
anotherList=[1,4]
range(*anotherList)


Out[6]:
range(1, 4)

In [7]:
d={"what":"My parrot","this":"is a green bird "}

In [8]:
def aFunc(what="I dont know",this=" this item"):
    print(what,this)
aFunc()


I dont know  this item

In [9]:
aFunc(**d)


My parrot is a green bird 

In [10]:
print('I am working with the result of previous interpretation. Result =',_,end=' ')


I am working with the result of previous interpretation. Result = range(1, 4) 

In [ ]:
from collections import deque
queue = deque(["Eric", "John", "Michael"])