from operator import itemgetter,attrgetter
def main():
#range function
mynms =list(range(10,20,2))
print mynms
print sorted([1,3,5,6,7,1,6,8,5,8,9,6,4,2,2])
print sorted(['a','h','t','x','b'])
items =['mikc','alxe','code','good','nice']
print items.sort() # this gonna not works
print sorted(items)
nums = [6,5,4,3,2,7,2,7,3,2]
nums.sort()
print nums # while this is gonna to work
bakk = [('books1','a',10),('books2','b',9)]
print sorted(bakk,key=itemgetter(2),reverse=True) #itemgetter(2) 0 1
# indexing and slicing
letters ='abcdgfgegege'
slice1 =letters[1:3]
slice2 = letters[:3]
slice3 = letters[1:]
slice4 = letters[:]
slice5 = letters[:-1]
print slice1 , slice2 , slice3, slice4 ,slice5
case = ['books','cup','dobule']
slice12 =case[0:2] # only 1 not included 2
print slice12
# sort in place
grocery =['bread','milk','cheese','egg','corn','juice']
grocery.sort()
grocery.sort(key=lambda x: x,reverse=True)
print grocery
newlist = sorted(grocery)
print newlist
main()