MindMap Gallery Python5 programming language mind map
This is a mind map about the Python5 programming language, including features, files, integrated development environment, modular design methods, Python functions, etc.
Edited at 2023-11-12 21:05:48This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
Python language
Features
object-oriented
Rich data types
Powerful module library
Extensibility (embeddability)
Easy to read and maintain
portability
Integrated Development Environment
Comes with integrated development environment, IDLE
Scientific computing integrated environment, Anaconda
Other integrated development environments such as PyCharm
grammar
basic characters
Numeric characters, such as 0, 1, 2, etc.
Uppercase and lowercase Latin letters: a~z, A~Z
Chinese characters
Some other printable characters, such as: !@#
Special characters, such as spaces and newlines
identifier
Variables are usually named with meaningful identifiers Day_of_year,ID_number
Identifier naming rules in Python: It consists of uppercase and lowercase English letters, Chinese characters, numbers, and underscores; Starting with English letters, Chinese characters, and underscores, the length is arbitrary, and it is case-sensitive; Cannot have the same name as a python keyword.
Keywords
Such as False, def, if, else, etc.
Objects and data types
Python objects
variable
The essence of a variable is a reference to a data object.
An immutable object whose value cannot be changed once created. Such as int, float, str, tuple, etc.
The value of a mutable object can be modified. list, dict, set, etc.
type of data
simple data type
int type int
float float
plural complex
Boolean type bool
sequence object
String str
tuple
list list
Other types
Collection type set
dictionary type dict
expressions and statements
expression
statement
simple statement
compound statement
Comment
Single line comments, starting with #
Multi-line comments, starting with three single quotes and ending with three single quotes Start with three double quotes and end with three double quotes
assignment statement
<variable> =<expression>
string
Created with "" or ''
Input and output statements
Input statement, <variable>=input(<prompt text string>)
Output statement, print(value, ..., sep=' ', end=' ')
Formatted output, 'format control string'% (value sequence)
Formatting function format, "<output string>".format (parameter list)
Modules and system functions
Built-in module, <function name> (parameter sequence)
Non-built-in modules
Import, import <module name>
Use, <module name>.<function>(<parameter>) <module name>.<literal constant>
General process of programming
analyse problem
design algorithm
Programming
Commissioning
control structure
sequential structure
Select structure
Single branch, if
Double branch, if, else
Multiple branches, if, elif, else
Loop structure
while loop
for loop
break and continue
Modular design approach
Modular design
Modules refer to relatively independent units that provide specific functions and have the characteristics of independence, abstraction, interchangeability, flexibility, etc.
Function definition and calling
The definition of a function includes the function name, formal parameters, and function body. The syntax for defining a function is as follows: def function name (parameter list): function body
Python functions
parameter
The essence of parameter passing
Default parameters
variable parameter
Global variables and local variables
global variables
local variables
global statement declares global variables
lambda function
definition
lambda parameter list: expression
as arguments to higher-order functions
recursive function
Features
Has recursive exit
With each recursive call, the problem is simplified
Algorithm design for batch data
sequence
Tuples and lists
Yuanzu
Create()
list
Create with []
Sequence operations
Join and copy operations
Index operations
Sequence functions, such as max, min, etc.
Logical judgment operation, in/not in
Traversal operation, for x in
Collections and dictionaries
gather
Created using {} or set()
dictionary
Creation form: d = {key1:value1, key2:value2,…}, d = dict(key1=value1, key2=value2,…)
document
Basic operations
open a file
f=open(file, mode='r',coding=none...)
with open(file, mode=‘r’,...) as file object
close file
Read data
f.read(size)
f.readline()
f.readlines()
for line in f:
Write data to file
Numpy data analysis module
Numpy
NumPy Ndarray objects
Create ndarray
numpy.array(object,dtype=None,copy=True,order=None,subok=False,ndmin=0)
Adjust array size
ndarray.shape
reshape
Create special array
numpy.empty
numpy.zeros
numpy.ones
Functions that create sequences
numpy .arrange() function
numpy.linspace() function
range() function
Array slicing and iteration
numpy.nditer
NumPy calculation
Conditional operation
Calculations
Pandas data analysis module
Pandas
Series
Create: pd.Series(data, index)
DataFrame object
Create: DataFrame([data, index, columns, dtype, copy])
Access the DataFrame object
Modify DataFrame data