First, the content
Ii. Exercise 1, Element classification
Requirements: A collection of the following values [11,22,33,44,55,66,77,88,99,90 ...], saving all values greater than 66 to the first key in the dictionary, and saving the value less than 66 to the value of the second key.
That is: {' K1 ': All values greater than 66, ' K2 ': All values less than 66}
L = [11,22,33,44,55,66,77,88,99,90]d = {' K1 ': [], ' K2 ': []}for i in Range (Len (l)): if l[i] >: d[' K1 '].append ( L[i]) else: d[' K2 '].append (L[i]) print (d)
2. Find
Requirements:
Finds elements in a list, removes spaces for each element, and finds all elements that begin with "L" or "L" and End with "K".
Li = ["Dark", "dxxk", "Lisa", "Tony", "SB"]
Tu = ("Dxxk", "Dark", "Lisa", "Tony", "Copila")
DiC = {' K1 ': ' Lisa ', ' K2 ': ' Dark ', ' K3 ': ' Lisa ', ' K4 ': ' Copila '}
3. Output Product List
4. Shopping Cart
5. User interaction, show the choice of three-level linkage between provinces and counties
Python day three: mutable types and immutable types, variable assignments, lists, tuples, dictionaries