Python jobs Learning 0311

# coding=utf-8

# 1, there is a list of [ 'alex', 49, [ 1900,3,18]], the list of names are removed, age, birth year, month, day assigned to different variables 
# L = [ 'alex', 49, [1900,3,18]] 
# name = L [0] 
# Print (name) 
# Age = L [. 1] 
# Print (Age) 
# year = L [2] [0] 
# Print (year) 
# L = month the [2] [. 1] 
# Print (month the) 
# Day = L [2] [2] 
# Print (Day) 
# 2, and insert a simulated queue list method pop 
# L = [] 
# l.insert (0, "A") 
# Print (L) 
# l.insert (. 1, "B") 
# Print (L) 
# l.insert (2, "C") 
# print(l)
# l.pop(0)
# print(l)
# l.pop(0)
# print(l)
# l.pop(0)
# print(l)

# 3. Simulation method pop the stack and insert the list 
# L = [] 
# l.insert (0, "A") 
# Print (L) 
# l.insert (. 1, "B") 
# Print (L) 
# l.insert (2, "C") 
# Print (L) 
# l.pop () 
# Print (L) 
# l.pop () 
# Print (L) 
# l.pop () 
# Print (L)

# 4, simple shopping cart, requirements are as follows: 
# implementation details print product, the user enters the number of trade names and purchase, it will trade name, price, number of buy to add to the list of triplets form, 
# if the input is empty or other illegal input require the user to re-enter  
# msg_dic = { 
#      'Apple': 10, 
#      'Tesla': 100000, 
#      'MAC': 3000, 
#      'Lenovo': 30000, 
#      'Chicken': 10, 
# } 
# pro_name = input ( 'Please enter your desired product:') 
# pro_num the iNPUT = ( 'Please enter the desired number:') 
# IF pro_num.isdigit (): 
#      inp_count = int (pro_num) 
#      IF pro_name in msg_dic: 
#          Print ((pro_name, msg_dic [pro_name],pro_num)) 
#     the else: 
#          Print ( 'Re-enter the product name!') 
# the else: 
#      Print ( 'Please re-enter the number of items!')

# 5, the following values of the set [11,22,33,44,55,66,77,88,99,90 ...], all values greater than 66 will be saved to the first key in the dictionary, 
# the the stored value to a value less than 66 in 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] 
# Small = [] 
# Big = [] 
# for L A in: 
#      IF A <66: 
#          small.append (A) 
# for B in L: 
#      IF B> = 66: 
#          big.append (B) 
# DIC = { 'K1': Big, 'K2': Small} 
# Print (DIC) 
# . 6, statistical s = 'hello alex alex say hello sb sb' of each word number 
# S = 'Hello Alex Alex say Hello SB SB' 
#} = {VALUE_COUNT 
# Print (s.split ()) # space divided by 
# for I in s.split (): 
#      J = s.count (I) 
#      VALUE_COUNT [I] = J 
# Print (VALUE_COUNT)

 

Guess you like

Origin www.cnblogs.com/liunaixu/p/12465256.html