First, the element classification
There is 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}
Second, find
Finds the elements in the list, removes the spaces for each element, and finds all elements that begin with a or a and end with C.
Li = ["Alec", "Aric", "Alex", "Tony", "Rain"]
Tu = ("Alec", "Aric", "Alex", "Tony", "Rain")
DiC = {' K1 ': ' Alex ', ' K2 ': ' Aric ', ' K3 ': ' Alex ', ' K4 ': ' Tony '}
Third, the output commodity list, the user enters the serial number, displays the user to select the product
Product Li = ["Mobile phone", "Computer", "mouse pad", ' yacht ')
Four, shopping cart
Functional Requirements:
Require users to enter total assets, for example: 2000
Display the list of items, let the user select the item according to the serial number, add the shopping cart
Purchase, if the total amount of goods is greater than the total assets, indicating that the account balance is insufficient, otherwise, the purchase succeeds.
Add: Can recharge, a product to remove the shopping cart
goods = [
{"Name": "Computer", "Price": 1999},
{"Name": "Mouse", "Price": 10},
{"Name": "Yacht", "Price": 20},
{"Name": "Beauty", "Price": 998},
]
Python-based data types and variables patr2