MindMap Gallery Python Chapter 2 Key Points of Basic Syntax
This article extracts the key contents of the book and summarizes them, covering all the core contents of the book, which is very convenient for everyone to learn. Suitable for exam review and preview to improve learning efficiency.
Edited at 2024-10-11 18:21:37Dive into the world of the Chinese animated film Nezha 2: The Devil's Birth! This knowledge map, created with EdrawMind, provides a detailed analysis of main characters, symbolic elements, and their cultural significance, offering deep insights into the film's storytelling and design.
This is a mindmap about Nezha 2, exploring its political metaphors and cultural references. The diagram highlights the symbolism behind the Dragon Clan’s suppression, drawing parallels to modern geopolitical conflicts and propaganda manipulation. It also details Chinese historical and cultural elements embedded in the film, such as the Jade Void Palace, Ao Bing’s armor, Taiyi Zhenren’s magic weapon, and Nezha’s hairstyle.
This is a mindmap about the main characters of Nezha 2, detailing their backgrounds, conflicts, and symbolic meanings. It explores the personal struggles and transformations of Nezha, Ao Bing, Shen Gongbao, and Li Jing as they navigate themes of rebellion, duty, ambition, and sacrifice.
Dive into the world of the Chinese animated film Nezha 2: The Devil's Birth! This knowledge map, created with EdrawMind, provides a detailed analysis of main characters, symbolic elements, and their cultural significance, offering deep insights into the film's storytelling and design.
This is a mindmap about Nezha 2, exploring its political metaphors and cultural references. The diagram highlights the symbolism behind the Dragon Clan’s suppression, drawing parallels to modern geopolitical conflicts and propaganda manipulation. It also details Chinese historical and cultural elements embedded in the film, such as the Jade Void Palace, Ao Bing’s armor, Taiyi Zhenren’s magic weapon, and Nezha’s hairstyle.
This is a mindmap about the main characters of Nezha 2, detailing their backgrounds, conflicts, and symbolic meanings. It explores the personal struggles and transformations of Nezha, Ao Bing, Shen Gongbao, and Li Jing as they navigate themes of rebellion, duty, ambition, and sacrifice.
Python Chapter 2 Key Points of Basic Syntax
1. Variables and data types
Variable definition: A variable is a container for storing data. There is no need to declare a type, just assign a value directly. x = 10 # integer
name = "Kimi" # string
Data type:
Integer type (int): Integer, such as 1, -3, 0.
Floating point type (float): decimal, such as 1.23, -0.001.
Boolean: logical value True or False.
String ( str ): text, such as "hello" .
List ( list ): An ordered collection that can contain elements of different types, such as [1, "apple", 3.14] .
Tuple: An ordered collection, immutable, such as (1, "apple", 3.14).
Dictionary (dict): A collection of key-value pairs. The keys must be of immutable type, such as {"name": "Kimi", "age": 30}.
Set: An unordered set with unique elements, such as {1, 2, 3}.
2. Basic operators
Arithmetic operators: , - , * , / , // (division), % (remainder), ** (exponentiation).
Comparison operators: == , != , > , = ,
Logical operators: and, or, not.
Assignment operators: = , = , -= , *= , /= etc.
Identity operator: is (used to compare the memory addresses of two objects).
Membership operators: in (checks whether an element exists in the sequence), not in.
3. Control flow
Conditional statements: Use if, elif, else to control the program flow. if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
Loop statement:
for loop: traverse sequences (such as lists, strings). for i in range(5):
print(i)
while loop: Repeatsly executes a block of code while a condition is true. i = 1
while i
print(i)
i=1
Loop control statement:
break: Exit the loop immediately.
continue: Skip the current iteration and continue with the next iteration.
4. Function
Define functions: use the def keyword. def greet(name):
print("Hello, " name)
Call a function: directly use the function name and parameters. greet("Kimi")
Parameter passing:
Positional parameters: passed in order.
Keyword arguments: passed by name.
Default parameters: Set default values.
Variadics: accepts any number of arguments.
5. Modules and packages
Import modules: Use the import statement. import math
Using modules: Call functions or variables in modules. math.sqrt(16) # Output 4.0
Functions and variables in modules: Modules can contain functions, classes, and variables.
Use of packages: A package is a collection of modules used to organize large projects.