1. swap two elements
a, b = b, a #fk, it is so easy.
2. Chained Logical
a < b <= c <d
same with:
a< b and b<=c and c<d
#lol, I love python, easy easy and easy
3. Indexing a sequence
x = [1,2,3,4]
x [1] #2
x[2:] #2,3,4
x[-1] #4
del x[1] #x = [2,3,4]
4. Iterators using "for"
for x in c:
statement(s)
5. List comprehensions
1: a = [1,2,3,4,5]
2: result1 = [x for x in a]
3: print result1
4: #print out [1,2,3,4,5]
5: #This is equals to
6: result1 = []
7: for x in a:
8: result1.append(x)
6. Parameters (* & **)
*identifier indicates that any call to the function may supply extra positional arguments
**identifier indicates that any call to the function may supply extra named agruments.