欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Lecture 7_1: Lists and mutability, dictionaries, pseudocode, introduction to efficiency

程序员文章站 2022-07-12 17:16:33
...
# example code, Lecture 7, Fall 2008

def showDicts():
    EtoF = {'one': 'un', 'soccer': 'football', 'never': 'janaie'}
    print (EtoF['soccer'])
    input()
#    print (EtoF[0])
    #Dictionary is not order.
    print (EtoF)
    input()
    NtoS = {1: 'one', 2:'two', 'one':1, 'two':2 }
    print (NtoS)
    print (NtoS.keys())
    input()
    print (NtoS.keys)
    input()
    del NtoS['one']
    print (NtoS)
    input()

def Dicts():
    dic = {'a':1, 'b':2}
    print (dic)
    print (dic['a'])
    list1 = dic.keys()
    print (list1)
    list2 = dic.values()
    print (list2)
    

相关标签: MIT