Python base data type and variable PATR2

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.