#coding=utf-8 #python里面的字典,用{}来表示 book={'title':'python web development','year':2008} print book print 'year' in book print 'pub' in book print book.get('pub','N/A') book['pub']='Addison Wesley' print book.get('pub','N/A') for key in book: print key,…
1.冒泡排序 lis = [56,12,1,8,354,10,100,34,56,7,23,456,234,-58] def sortport(): for i in range(len(lis)-1): for j in range(len(lis)-1-i): if lis[j]>lis[j+1]: lis[j],lis[j+1] = lis[j+1],lis[j] return lisif __name__ ==…