Composition of a computer: input device, output device, memory, arithmetic unit, controller

Computer configuration:

Keyboard and mouse: input device to input valid information to a computer display: display screen: audio: play sound chassis: main board: carrier that connects all other devices CPU: Central Processing Unit: the computing and control core of a computer Memory: Mainly responsible for hard disk and other hardware equipment data and data exchange between THE CPU, storage is temporary data [temp, these data lost after the computer shut down] graphics card: responsible for all information on the display disk: storage data, features: large capacity, shutdown will not be lost [data warehouse]Copy the code

1. What is software

System software: Windows, Linux, Mac OS, IOS,Android note: The representative System software is the operating System [OS, Operation System], which is the lowest level of software. Its role is to control the programs run by all computers and serve as a bridge between computer hardware and application programs. Application software: QQ, wechat, etc.Copy the code

2. What is development

Is the process of making software the emergence of software to achieve human-computer interaction interaction mode: graphical interface: command line mode: in the console input corresponding instructions, according to the instructions let the computer complete some operationsCopy the code

3, command line [DOS command]

Windows:

CD change directory, enter the specified directory CD.. Go back to the previous directory CD.. \.. Back up two levels CD/Back up the root directoryCopy the code

Path types: Absolute path: a path with a corresponding drive letter Relative path: a path without a drive letter. Find a reference

Drive letter: Switch drive letter [e.g. D:]

CLS [empty console command]

[know]

Rd delete directory rd /s /q Delete files and directories rd /s /q delete files and directories rd: Delete a specified file copy Original path Target path Copy Original path Target path move Cut exit Exit DOS command line close terminalCopy the code

1. Programming language

The rules of interaction with a computer are called programming language. programming languages == learning grammar rulesCopy the code

2. Introduction of Python

2.1 History of Python

Python was invented by the Dutch in 1989, and the first version was released in 1991. 1999: Development of the support website 2000:2.0, which forms the basis of the current Python language framework. 2004:2.4, and Django, the Web framework in Python. 2.6 December 2008:3.0 2010:2.7 Industrial version used 2.7, now new projects use 3.xCopy the code

The characteristics of the Python 2.2

A. is an interpreted language b. is an interactive language [interactive development can be done directly with a Python prompt: Write Python code directly from a terminal] C. Python is an object-oriented language D. Is a cross-platform language.Copy the code

2.3 Advantages and disadvantages of Python

Advantages: a. Easy to read and maintain b. an extensive standard library C. databases [Interaction between Python and various major databases] D. F. embedding Python into C++ programs. Disadvantages: a. Slow operation b. Code cannot be encryptedCopy the code

3. The application of Python

Web development, crawler, operation and maintenance, data analysis [big data], artificial intelligence back-end development, front-end development [electronic mall, OA system, forum]Copy the code

Data storage and Conversion How does the bottom layer of a computer work

1. Think about the problem

A. Why use a computer? B. Where is the data stored on the computer? C. How does a computer store data? How to store numbersCopy the code

2. The memory

On/off: At the bottom of the computer, data is represented by 0s and 1s, making it more efficient to run. Bit -b, also known as the smallest unit of data processing in a bit computer: Byte- b 1B = 8b KB\MB\GB\TB\PB\EB... \DB 1KB=1024B Summary: computers use binary mode to store data in memoryCopy the code

3, into the system

3.1 What is base

A. Base is a base bit, a method of carrying digits. Common base: binary [symbol sets 0 and 1], decimal [0~9], octal [0~7, starting with the digit 0] hexadecimal [0~9, a~f or a~f, starting with 0x or 0x]Copy the code

3.2 Characteristics of base system

A. Each base system has a specific set of symbols b. Each base system uses positional notation Brackets said power of 145-100, 10 (2) 761-1-817-10 (0), 10 -, 10 (1) c. Binary calculation 0+0=0 0+1=1 1+0=1 1+1=10 11+1=100Copy the code

3.3 Conversion between bases

A. Decimal ---- "Binary conversion principle: for integers: Divide decimal by 2 until the quotient is 0, and reverse the remainder 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 For decimals: The integer part is the same as above. Multiply the decimal part by 2 and round it up until the integer part is 1. B. binary ---- "decimal conversion principle: the binary according to the corresponding weight expansion, add can get decimal. 110---- 0x2(0)+1x2(1)+1x2(2)=6 1001 0110---- 128+16+4+2=150 c. Binary ---- "octal conversion principle: the corresponding binary from right to left in accordance with the 3 bits as a group to group, complement 0, and then the corresponding binary in each group into decimal, finally the decimal obtained in each group together. 1001 0110---- 010 010 110---- 226---- 0226 1010001-- 001 010001 ---- 121 ---- 0121 D Binary hd Hexadecimal conversion principle: Group the corresponding binary from right to left in a group of 4 bits, complement 0 when insufficient, and then convert the binary in each group to decimal, and finally connect the decimal obtained in each group. 1001 0110---- 1001 0110 ----- 96 ------ 0x96 1010001-- 0101 0001 ---- 51 ----- 0x51 1011 1110-- 11 14 ----- be 111011 ---- 0011 1011---- 3 11 ------- 0x3b e Decimal ------ "octal or hexadecimal conversion principle: Mode 1: convert decimal to binary, and then convert binary to octal or hexadecimal mode 2: Mod decimal divided by 8 or 16 until the quotient is 0, remainder reversed f. Octal or hexadecimal ---- decimal conversion principle: expand directly by weight, and then addCopy the code

4. Source code inverse and complement

Questions to consider: a. Why is it possible to complement the original code? Data are divided into positive and negative ones. B. Is the data stored in the computer's underlying storage source code, inverse code or complement code?Copy the code

4.2 the use of

2. The binary representation of a number, in which the high level represents a sign bit, 1 represents a negative number, and 0 represents a positive number. The smallest unit of data processed by a computer is one byte. A byte is equivalent to eight bits. In general, eight bits are used as an example to see the highest bit. The original code in addition to the sign bit by bit from the [0-1, 1 - > 0] 6 -- -- -- -- -- -- -- -- - "0000, 0110-6 - -- -- -- -- -- -" 1111 1001 complement: [0000 0001] 6------- "0000 0110-6 ------" 1111 1010Copy the code

Is the data stored in the underlying computer source code, inverse code or complement code?

Take 8-bit for example

10+ (-10) =0——–>0000 0000

10 0000 1010-10 1000 1010

1001, 0100,Copy the code

10 0000 1010-10 1111 0101

1111, 1111,Copy the code

Complement: 10 0000 1010-10 1111 0110

     0000  0000 ----》0
Copy the code

Conclusion: Data processing in computer is in the form of complement code

Question to consider: If numbers are stored in the computer in binary, how should a text, such as "Hello," be stored in the computer? Mapping: Convert complex text to numeric ASCLL encoding: 0---- 48 a------->97 a -------->65 UTF-8 Unicode GBKCopy the code

First Python program

Interactive patterns, text documents, PyCharmCopy the code

Python coding Specification and Comments 1

A semicolon: don't added any semicolons [note: the best is a line of one statement 】 b, length: each line of code normally does not exceed 80 characters c, parentheses: cannot lack the necessary brackets [note: in some complex operation, had better use parentheses 】 d, indentation, with four Spaces represent the indentation e, a colon: F represents the beginning of a block of code and appears in Chinese: comments and stringsCopy the code

2, the annotation

Note: This is an explanatory text, which can be skipped by the corresponding program when it is running. Note: It is possible to nest single-line comments in multi-line comments, but try not to nest a multi-line comment in multi-line commentsCopy the code

Keywords and identifiers 1. Keywords

Examples of English words that have been given special meanings in Python are: break, class, import, from, continue, return, or, not, etcCopy the code

2. Identifiers

Some custom character names in Python programs define rules for legal identifiers: a. Contains only digits, letters, and underscores (_). B. Cannot start with a digit. C. Cannot contain the Python keyword D. Do not use any other special symbols e. strictly case sensitive f. Try not to appear Spaces or Chinese definition of the identifier specification: a. Try to see the meaning of b. Writing style 1: Official Python recommendation: Use all lowercase letters and underline links between different words (for example, stu_score) style 2: Follow the hump naming method [capitalize the first letter between different words] Big hump: StuScore Small hump: StuScoreCopy the code