作业3


strBig="""Remembering me,   Discover and see   All over the world,   She's known as a girl   To those who a free,   The mind shall be key   Forgotten as the past   'Cause history will last   God is a girl,   Wherever you are,   Do you believe it, can you recieve it?   God is a girl,   Whatever you say,   Do you believe it, can you recieve it?   God is a girl,   However you live,   Do you believe it, can you recieve it?   God is a girl,   She's only a girl,   Do you believe it, can you recieve it?   She wants to shine,   Forever in time,   She is so driven, she's always mine   Cleanly and free,   She wants you to be   A part of the future,   A girl like me   There is a sky,   Illuminating us, someone is out there   That we truly trust   There is a rainbow for you and me   A beautiful sunrise eternally   God is a girl   Wherever you are,   Do you believe it, can you recieve it?   God is a girl   Whatever you say,   Do you believe it, can you recieve it?   God is a girl   However you live,   Do you believe it, can you recieve it?   God is a girl   She's only a girl,   Do you believe it, can you recieve it? """ s1=strBig.lower() print(s1) strList=strBig.split() print(strList) strListSort=strList.sort() print(strListSort) print(strList) for word in strList: strList.count(word)

classmates=["Mike","Bob","Tracy","小君","Tracy",56]
new=["Rose","Jack"]
classmates.insert(2,"Tom")
classmates.append("Jack")
classmates.extend(new)
print(classmates)
classmatesSet=set(classmates)
classmatesSet.add("Jack")
classmatesSet.remove("Bob")
print(classmates)
print(list("ababcd"),tuple("ababcd"))

 

 

列表:用list()函数或者[]创建,是可变序列。
元组:用()或者tuple()函数来实现;是不可变序列。
字典:用dict()函数或者{}创建,使用键-值(key-value)存储,键是不可变的对象。
集合:用set()函数或者{}创建,是一个无序不重复元素集。

posted @ 2018-09-22 19:51  Peace*  阅读(91)  评论(0)    收藏  举报