Python Basics Learn the next day

Source: Internet
Author: User

Comment Classification line Comment Multiline comment function use your own familiar language, in the program to annotate some code, enhance the program readability line Comments (line comments) Start with #, #右边所有的东西就被当成说明文字, rather than the program to execute, just explain the role in the program development, you can use the # Add explanatory text after code, two spaces between comments and code multiple lines of comments (block comments) If you want to comment a lot of information, a row can not be displayed, with a multiline comment a pair of consecutive three quotation marks (both single and double quotation marks) when to use comments? There is no need to annotate the code at a glance. For the send and go operations, appropriate negotiation of several comments for code that is not at a glance, add comment explanations at the end of the code note: Some formal development teams, usually with code reviews, Allow everyone on the team to read their own code about code specification Python provides a series of pep documentation for the eighth article on Python's code format, commonly known as the PEP8 arithmetic operator Note: in Python,*It can also be used as a string, and the result is a specified number of repetitions of the string. Big three of the program execution Principle (science) Computer1. CPU, is a super-large-scale integrated circuit responsible for processing data/Calculation2Memory temporarily stores data (data disappears after power loss) fast space (price per unit high)3the hard disk permanently stores data slow space (low unit price) program execution principle before the program runs, The program is saved on the hard disk when you want to run a program: The operating system will first have the CPU to copy the program into memory CPU execution program code in memory (0 or 1) Python program operating system first let the CPU copy the Python interpreter program into the in-memory Python interpreter according to the syntax rules , from top to bottom let the CPU translate the code in the Oython program CPU is responsible for performing the translation done by the Code of the program is the basic use of variable variables to process the data variable name variable=types of numeric variables1. Creating a variable in memory will include: variable name variable the address of the type variable that holds the data variable stored2. Defining a variable in Python is not required to specify a type3data types are divided into digital and non-digital integer type (int) floating-point type (float) Boolean (bool) TruetrueNot 0 number--not 0 and true or falsefalse0the plural type is mainly used for scientific calculation, plane problem, fluctuation problem non-numeric string list meta-ancestor dictionary Note: The type function can view the types of a data between different types of variables between the computed numeric variables can be directly computed between the string variables used+stitching character strings can be used with integers*repeated concatenation of string numeric variables and strings cannot be entered into by other operands. Gets the information that the user entered on the keyboard and needs to use any content entered by the user into the input function what does Python think of as a string function? A pre-prepared feature that can be used directly without caring for the internal detail type conversion functionint(x) convert x to an integerfloat(x) formatted output to convert X into a floating-point variable%is a format operator that specifically handles formatting in a string%s String%d signed decimal integer,%06d indicates the output display bit number, insufficient place 0 complete%f floating point,%. 02f indicates a two-bit decimal point% OUTPUT%Example: Name= "Little Daming"Print ("My name is%s, please give me a lot of attention"% (name))

Python Basics Learn the next day

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.