Python Learning-day2:python Foundation II

Source: Internet
Author: User

Main content:

    • Variable storage
    • Formatting of strings
    • Bit arithmetic
    • Enter ciphertext display
    • If...else
    • Ternary operations
    • List
    • Dictionary
    • Variable

Name2 directly points to the memory data, when the name changes, the previously stored data values and location are unchanged, new memory space to store new data.

    • Formatting of strings
The string is%s; integer%d; floating-point%f;%r is raw data, not escaped

    • Bit arithmetic

    • Enter ciphertext display
Introduced Getpass,import gatpass use: pwd = Getpass.gatpass ("Passwod:") Pycharm does not support running continue is jumping out of this loop, continuing the next loop break out of the entire loop
    • Ternary operations

If the condition is true: result = value 1

If the condition is false: result = value 2

Space-occupying
    • Tuples, not modifiable after definition
    • String

    • Dictionary
A key-value data type, used as a dictionary of our school, to check the details of the corresponding page by strokes and letters. Features of the dictionary:
    • Dict is disordered.
    • Key must be unique
Job: 1, print provincial and county level three menu, any layer of Q exit, any layer B return upper 2, shell sed replacement function. Implemented in the command line

Python Learning-day2:python Foundation II

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: info-contact@alibabacloud.com 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.