# shows how sorting with lists works
a = [5, 1, 4, 3]
print sorted(a)
print a # unsorted

# sorted function
strs = ['aa', 'BB', 'zz', 'CC']
print sorted(strs) # forward
print sorted(strs, reverse=True) # reverse

# Using key=len function
strs = ['ccc', 'aaaa', 'd', 'bb']
print sorted(strs, key=len)

# force uppercase & lowercase to be treated the same
print sorted(strs, key=str.lower) 

# sorted by the last letter of the string
strs = ['xc', 'zb', 'yd', 'wa']
# function takes a string and returns its last letter
def MyFn(s):
  return s [-1]
# pass function into sorted
print sorted (strs, key=MyFn)

# Tuples - fixed sized grouping of elements using X&Y coordinates
tuple = (1, 2, 'Ahh!')
print len(tuple) # Ahh!
tuple = (1, 2, 'bye') # works

#Creates a size 1 tuple
tuple = ('hi',) 

# errors
#(x, y, z) = (42, 13, "hike")
#print z
  #(err_string, err_code) = Foo() doesn't work

