Article From:https://www.cnblogs.com/huangdong-/p/9970417.html

A Programming Language Classification

   Machine Language: Using Binary Instructions to Write Programs

   Assembly Language: Use English labels instead of binary instructions to write programs and directly operate hardware. Hardware must be considered.

   High Level Language: Write programs in a way that humans can understand. Operate hardware indirectly through the operating system, without considering hardware details.

       Compiler: Similar to Google Translate

       Interpretative: Similar to simultaneous interpretation

      Executive efficiency: machine language & gt; assembly language & gt; compiler & gt; interpreter

      Development efficiency: interpretive & gt; compiler & gt; assembler & gt; machine language

       Cross-platform: explanatory & gt; all

 

II. Installation of Python

Setting environment variables: win7F:\Python36\Scripts;F:\Python27\Scripts;F:\Python36;F:\Python27;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell

 

Three ways to execute Python program

   1.Interactive environment for debugging programs, unable to save code permanently

     2.Write the program into a file and save it permanently. The way of execution is as follows:

          python3    F:\test.txt/py       #It should be changed to PY

    

          Three phases of running Python program###very important

              1.Start the bython interpreter first

               2.PythonThe interpreter reads plain text from the contents of the test.py file into memory (without grammatical concepts)

               3.pythonThe interpreter interprets and executes the code just read in and begins to recognize Python grammar

 

“””
1. What is a variable?
Quantity: Recording a state of something in the real world
Change: A certain state of things can change.

2. Why use variables
In order to enable computers to record certain states of things like human beings

3. How to use variables
Principle: Define first, quote later
“””
#1. First define
age=18
# The three main components of defining variables are:
#1.1 Variable name: The only way to access a value
#1.2 =:Bind the memory address of the variable value to the variable name
#1.3 The value of a variable: The data we store is used to represent a state of something.

#2. Post reference
print(age)

#3. Naming of variable names
#3.1 Major premise: variable names should have descriptive effects on values
#3.2 Naming specification
#I. Variable names can only be any combination of letters, numbers, or underscores
#II. The first character of a variable name cannot be a number
#III. Keyword cannot be declared as variable names [‘and’,’as’,’assert’,’break’,’class’,’continue’,’def’,’del’,’elif’,’else’,’exce’.Pt’,’exec’,’final’,’for’,’from’,’global’,’if’,’import’,’in’,’is’,’lambda’,’not’,’or’,’pass’,’print’,’raise’,’return’,’try’,’while’,’with’,’yield’]
#3.3 Naming style:
#I:Hump body
OldboyOfAge=73
#II:Pure lowercase letters + underscores
oldboy_of_age=73

Interaction with users

1.Accept user input

name=input(”Please enter your account”)

print(name)

2.Format output

name=input(”Please enter your account”)

age=input(”Please enter your age’)

print(‘my name is %s my age is %s ‘ %(name,age))

Leave a Reply

Your email address will not be published. Required fields are marked *