How to create a project on Pycharm
Open Pycharm, click on the File option in the menu bar, choose New Project, jump out of a new project box, select Pure Python in the left column, there will be two lines on the right, the first line is to select the project created address and project name, The second line is to select the version of Python that you use, and then click Creat in the lower right corner. The project is now created. Then click on the right mouse button to create the project name on the right side of the window, select New, then choose Directory, and a directory will be created. Navigate to the name of the directory you just created click the right mouse button to select New, then select Python file, a python files are created.
Variables: Used to store data, the assignment of variables in Python can make integers, floating-point numbers, strings, and so on. The address that the variable points to is the address of the stored data.
Constants: Python does not support constants, but often there is a variable description constant in uppercase letters, that is, the amount that cannot be changed.
Character encoding:
The commonly seen #-*-Coding:utf-8-*-represents the encoding of the utf-8 used. It supports 1 bytes of English and accounts for 3 bytes of Chinese. Chinese is supported by default in Python3, but not supported in python2, this procedure needs to be written.
Comments:
Single-line Comment: #, multiline Comment: "", which can also be used to print multiple lines of characters, such as:
Print ("'----------------
--------------
-------------‘‘‘)
User interaction: User=input (""), Python2 common raw_input ()
Format input:
To print something in a certain format, the usual method is as follows:
Name=input ("")
Age=input ("")
information= "-------------Information of%s---------------
Name:%s
Age:%s
"% (Name,name,age)
Print (information)
or information= '----------------information of {_name}
Name:{_name}
Age:{_age} ". Format{_name=name,
_age=age}
If-elif-else Judgment:
If conditions are true:
(indent) program code that meets the above criteria
Whether the elif condition is established:
(indent) program code that meets the above criteria
Else
While loop
Conditions for While loop execution
Encoding to be executed when the loop condition is met (indented)
Else
Encoding to be executed when the loop condition is not met (indent)
For loop
For I in range (n,m,k) #n是起始值, M is the terminating value, K is the step
Else
(indent) If the for does not stop halfway, execute the ELSE program, otherwise it will not execute.
Break: Terminates the current entire loop
Continue: Terminates the current loop and enters the current next loop
python-variables, user interactions, loops