(13) Create a list of your favorite singer.
1 # singer=list()
2 # singer=['a','b','c']
3 # print(singer)
(Xiv) Creates a list of tuples, each tuple contains latitude and longitude lived or traveled in the city.
1 # s=tuple('1.1','2.2','3.3')
2 # print(s)
(Xv) to create a dictionary that contains your different attributes: height, favorite color and favorite authors and so on.
1 # zi_dian={"height":"1.9m",
2 # "color":"blue",
3 # "author":"鲁迅"}
4 # print(zi_dian)
(Xvi) Write a program that allows users to ask your height, favorite color or favorite author, and returns the dictionary created a challenge.
1 # zi_dian={"height":"1.9m",
2 # "color":"blue",
3 # "author":"鲁迅"}
4 # print(zi_dian["height"])
5 # print(zi_dian["color"])
6 # print(zi_dian["author"])
7 # print(zi_dian)
(Xvii) create a dictionary that maps favorite singer to your favorite songs.
1 # singer={"123":"456",
2 # "789":"998"}
3 # print("singer")
(Xviii) a list of tuples is only part of the container and the container is built Python. Self-study collection of Python. (Also a container) Under what circumstances can use the collection?
: Think about, and the difference between the set list tuple of
(XIX) to print all characters in the string "Camus" in.
1 # v = "Camus"
2 # print (v [0])
3 # print (v [1])
4 # print (v [2])
5 # print (v [3])
6 # print (v [4 ])
(Xx) the preparation procedure, at two strings obtained from the user, to insert a string "Yesterday I wrote a [user input 1]. I sent it to [User Input 2]!", The new string and the prints .
1 # c=input("type a str:")
2 # d=input("type a str:")
3 # a="Yesterday I wrote a {}. I sent it to {}!".format(c,d)
4 # print(a)
(Xxi) to find ways to string "aldous Huxley was born in 1894." The first character capitalized, so that the syntax is correct.
1 # a="aldous Huxley was born in 1894"
2 # v=a.capitalize()
3 # print(v)
(Xxii) "? Who now? When now Where now?" String call a method that returns a list such as the following [ "Where now?", "Who now?", "When now?"].
1 # a="Where now? Who now? When now? "
2 # v=a.split("?")
3 # print(v)
(Xxiii) the list [ "The", "fox", "jumped", "over", "the", "fence", "."] Processing, turning it into a syntactically correct string. Between each word with a space delimited, but can not have spaces between words and the fence period. (Do not forget, before we have learned the method string list into a single string.)
1 # s=["The", "fox", "jumped", "over", "the", "fence", "."]
2 # v=" ".join(s)
3 # v=v.strip()
4 # print(v)
If wrong, please correct me!