Preview notes day 1

1. Computer Basics

  1. Computer basis: Composition --- O CPU memory storage device

    1. cpu CPU: various types of data processing
    2. Memory for storing data
    3. Hard disk to store data
  2. What is the operating system: control of the computer workflow software

  3. What is the application: software is installed on top of the operating system

    Summarize a. CPU human brain

    1. Memory person's temporary memory
    2. Hard disk memory of people forever
    3. Operating system process control computer
    4. Software applications installed on the operating system

2. python Profile

python python. 3 and 2 of the difference between

python 2 source code is not uniform repeat

python 3 is not unified source code duplication

Compiled: Compiled: Compiled:

Compiled: advantages: run fast

Cons: Slow development efficiency

Interpreted: Advantages: fast development efficiency

Cons: Slow speed

3. Getting Started

print () output

variable

print(12+34)
print((12+34)2)
print(((12+34)
2)*3)

Variable rules:
1. The variable is made up of letters, numbers, underscores
2. Prohibition was the beginning of the digital
3. prohibit the use of keywords in print python
4. You can not use Chinese and Pinyin
5. variable names are case-sensitive
6. recommended wording

CamelCase:
large peak
small peak
underlined name:
official recommended
7. To descriptive variable names

a = 12
the variable name assignment value

7s = 'Hello' wrong

ab = 123 wrong

alex_sb = 666 Dui

_ddd = 'ss' of

constant

ALEX = 2022

ID = 110120130140

Note

Single-line comments (comment when the line) can not wrap

Multi-line comments "" "" "" or '' '' ''

"" "
I would like to recite a poem to praise my classmate,
you look at his short black hair
like a Soke chicken ah
" "" can wrap

Data Types acquaintance

Plastic figures

String of characters

Boolean value right or wrong

List

Originator

dictionary

Set
'string'
"" "string" ""

digital

"String"

"字符串"
        "my name is meet i'm 22 year old"

        a = 'alex'
        b = 'wusir'

        print(a+b)  字符串拼接  注意: 只能和字符串相加
        a = '坚强'

        print(a*8)  字符串乘    注意: 只能和数字相乘

Boolean value:

True False

It is true
10
user interaction (input)
Input Output

user = input("请输入账号:")  
password = getpass.getpass("请输入密码:")  
print(password)
print(user)
只能在cmd 中使用

(Type) type
string STR
int shaping
bool Boolean

input acquired are strings

Flow control statements

if if

Single IF
IF condition colon keyword spaces
to indent results

                                if 3>2:
                print("你好美,小学")

            if else
            如果 否则

            if 条件:
                结果
            else:
                结果

            if elif
            如果 在如果

            if 条件:
                结果
            elif 条件:
                结果
            elif 条件:
                结果

            if if

            if 3>2:
                print(1)
            if 4>3:
                print(4)
            if 5>1:
                print(6)
                
                
            if 嵌套

            if 条件:
                结果
                if 条件:
                    结果
                    if 条件:
                        结果

Guess you like

Origin www.cnblogs.com/wuzifan/p/11116480.html