Day 2 Introduction to Programming Language Classification Python Introduction to Understanding Variables

Classification of programming languages.
Machine language : Use binary instructions to write programs (equivalent to directly use high and low frequency to control computer hardware, you need to have a special understanding of computer hardware)
Advantages: Direct control of hardware, high execution efficiency
Disadvantages: Binary instructions are difficult to remember, extremely Error-prone,
programming complexity is extremely high

Assembly language : Use English words instead of binary instructions to write programs (some encapsulation of machine language binary, special knowledge of computer hardware is required)
Advantages: Compared with machine language learning, the difficulty of learning is slightly lower, and the execution efficiency of hardware is still very high.
Disadvantages: programming is still very difficult

High-level language : Use a human-understandable language to control computer hardware.
High-level language computers cannot directly understand and need to be translated to control the computer. According to the type, it is divided into compiled and interpreted types.

Compilation type (c language, go language): After the program is written, it will directly enter a browser like Google for translation and execution.
Advantages: The efficiency of the program is higher than the interpretation type.
Disadvantages: When the code has a bug, the debugging process of the program is very trouble

Interpretation (python, shell): You need to install an interpreter to write and execute
programs in an interactive environment. Advantages: In the process of writing programs, in an interactive environment, debugging is very convenient and code writing efficiency is high.
Disadvantages: During the running of the program, each line of code needs to be translated and executed by the interpreter, and the execution efficiency of the code is lower than that of the compiled type.

Introduction of
python Guigo, the founder of python, python is divided into python interpreter and python grammar. The python interpreter is written in C language. Currently, programs are developed in python. The interpreter only supports python3.0 and above. In April this year, the python2.7 version was the last version of 2.0, and the 2.0 version is no longer updated. At present, some companies may still have software that uses python2.0 or higher.

Install multi-version python interpreter
After
downloading version 2.0 or higher and version 3.0 from the official website python.org , enter the environment variables of the windows system. Change the path setting, add the file path of version 2.0 and 3.0, enter the folder to add a copy of the python2.0 version and python3.0 version of the software, and rename the software (for example: python2, python3). Note: pip (python's third-party library) should also add the file path of the environment variable.

Three-stage
interactive environment for running python programs
Advantages: instant code running, convenient for code debugging
Disadvantages: code cannot be saved permanently

The python program needs to be written into a file, and the saved file is directly stored in the hard disk.

1. Start the python interpreter first
2. Cache the file from the hard disk to the memory
3. The python interpreter will interpret and execute the content of the code file according to the python syntax

IDE (Integrated Development Environment)
install pycharm software

Notes
Adding notes is mainly to increase the readability of programming content

"" "
Comment 1
Comment 2
Comment 3
" ""
This is a multi-line comment, usually there is only one multi-line comment, mainly the full text of the comment.

#单行评论
print("hello world")#Single-line comments
Single-line comments usually mark some core code programs, usually written directly on the top of the program or behind the program.
Comments can temporarily suspend the code that you don’t want to run
. Shortcuts to sort out the comments ctrl+alt+l
batch add and subtract comments: After selecting the code file, ctrl+?

Variables
What is a variable
amount refers to the state of affairs
variant refers to a state of things can be changed to
a variable refers to the state of things recorded, and the recorded data is changed

Variables are a mechanism for storing memory

Why use variables
In order to make computers record the state of things like humans, and the recorded data is changeable

How to use variables
First define (store the variable first)
variable name = "variable value" (the variable name is the variable name without quotation marks, and the variable value becomes the variable value after quotation marks) ("=" is called the assignment symbol) (variable The value is the state of the transaction record, that is, the data stored in the memory) and
then reference

The first character of a variable name cannot be a number. Such naming is considered illegal

Some simple commands summarized today
print ("hello world")

import time import a time library

time.sleep(1000) sleep in place for 1000 seconds

tasklist lists some tasks that are being started
taskkill kills the process
taskkill /F force kills
taskkill /F/PID ID number

Guess you like

Origin blog.csdn.net/Yosigo_/article/details/111300446