Python First Knowledge

Source: Internet
Author: User

1.
CPU: central processing unit, human brain, Computing center, control Center.
Memory: Temporarily stores data, interacts with the CPU,
Advantages: Fast reading speed
Disadvantages: Small capacity, high cost, power loss disappears.
HDD: Long-term storage data
Advantages: Large capacity, relatively low cost, power failure does not disappear.
Disadvantage: Slow reading speed.
Control system: governs these processes.

Enter a symbol that must be in English.

The difference between python2x and 3x:
1
2x: Source code is not standard, the source is repeated too much
3x: Clear source, beautiful, simple
2
2x:
Contain Chinese error
Default encoding: ASCII (English included)
Include Chinese code (#-*-Encoding:utf-8-*-)
3x:
Printed in both English and Chinese can be displayed
Default encoding: Utf-8 (contains Chinese, English, European text)

The classification of Python.
Compile: Compile the code all at once into bytecode, then execute.
Representative language: C
Advantages: Fast execution speed.
Disadvantages:
Cannot cross the platform.
Development speed is slow.
Inconvenient to Debug.

Interpreted: The code interprets and runs on a line-by-row basis.
Representative language: Python
Advantages:
Easy to Debug.
Cross-platform.
Fast development efficiency.
Disadvantages:
Slow execution speed.


The type of Python.
Cpython (C-language-readable byte code)
Jpython (Java-language-readable byte code)
Python in other languages

PyPy (interprets interpreted language as a compiled type)

Variable
Variables are the staging of intermediate results for some data so that subsequent programs can invoke
Variable use
1. Variables can only be combined by numbers, letters, underscores
2. Cannot start with a number
3. Cannot be a keyword in python
4. Variables to be descriptive
5. Variables cannot be used in Chinese
6. Variable cannot be too long
7. Variables cannot use Pinyin
8. Official Recommended Use:
Hump Body (ageofoldboy = 1000)

Underline (Age_of_old_boy = 1000)

Constant
Often placed at the top of the file.

Data type
numeric types, strings, Boolean values

Number Type
Float floating-point i = 3.1415
int integral Type I = 36

String type in Python, which is usually quoted as a string.
S1 = ' Alex '
S2 = "Alex Mfullyaware 1"
S3 = "I ' m Taibai"

Tape Judging data types

Judgment statement
If
If Else
Elif


Base data type Initial (Int,str,bool)

Python First Knowledge

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.