English Study Two
Project2DataVisualization
Ignore constants
Constant time and linear time
Use mathematics to express the step length
deprecator
Set the axis scale
MultipleLocator
Binary search == Linear search
Why algorithms are important
Allow duplicate values
Avoid empty physical addresses
Collection: One rule determines performance
Delete data instead of index
the speed of operation is not calculated by time but by the number of steps
time complexity
cucumber == elderberry
the based data structure:array
Why data structure is important
Sorting Algorithm
Comma-Delimited File –>csv
subscriptable
descendant
Perform api call and store response
Process the information of each article
For each article, perform an api call
Corresponding format
uniform resource locator –> url
if-elif-else conditional statement
Add a clickable link to the chart
Draw graphs based on data
Add custom tooltips
Overview of the most popular repository
Research the first repository
Explore information about the repository
Processing api response
Use api call to request data
application programming interface
Highlight color theme
Use pygal to style the world map
Execute api call and store response
Store the api response in a variable
Hide legend
improve pygal chart
Divide all countries into three groups based on population
Group countries according to population
Draw a complete world population map
Presenting digital data on the world map
If the specified country is not found, return none
According to the specified country, return the two-letter country code used by pygal
Get the first two letters as an identifier
binary(10) –> decimal(02)
Convert string to integer value
Nest dictionaries in the list
Making a world population map: json format
Line transparency
Color the drawing area
In the same code block, you need to keep the axis consistent when drawing multiple charts
Plot another data series
Cover a longer period of time
a common use case:一个常见的用例
Date tick-labels often overlap, so it is useful to rotate them and right align them. Also, a common use case is a number of subplots with shared x-axis where the x-axis is date data. The tick-labels are often long, and it helps to rotate them on the bottom subplot and turn them off on other subplots, as well as turn off x-labels.
日期刻度标签通常会重叠,因此旋转它们并使其右对齐很有用。 同样,一个常见的用例是具有共享x轴的多个子图,其中x轴是日期数据。 tick-label通常很长,它有助于在底部子图上旋转它们,并在其他子图上将其关闭,以及关闭x-label。
According to the original data, here should be modified to%Y/%m%d
Convert string to date object
Draw the chart based on the data
Chart temperature
If you traverse the document directly, you start traversing from the row content |
Get the maximum temperature from the file
Extract and read data
Print file header and its position
Return the contents of one line of the file
Can be inherited and called
install
:安装 –> download
:下载
Quickly create a list
Color mapping target data
learning target
Remove duplicate elements
Throw two dice with different faces at the same time
Send an interactive message
Count the number of occurrences of value in the list
Represents the class of a dice
It has six sides by default
Returns a random value between 1 and the number of faces on the dice
Requirement already satisfied
Use pygal
to simulate a dice roll
Units are inches
Set the size of the drawing window
Increase points
Redraw the start and end points
Highlight the start and end
cm=
Data that needs color mapping cmp=
plt.cm.Colors
if conditional statement
As long as the program is active, it will continue to simulate random walks
simulate multiple random walks
Determine the direction of travel and the distance to travel in this direction
Refuse to stand still –> choose direction
Calculate the x and y values of the next point
Calculate all points included in a random walk
Keep walking until the list reaches the specified length
All random walks start at (0, 0)
A class that generates random walk data
i/o conflict
You must replace plt.show with plt.savefig or the saved chart will be blank
Automatically save the chart
use color-map 使用颜色映射
c argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with x & y. Please use the color keyword-argument or provide a 2D array with a single row if you intend to specify the same RGB or RGBA value for all points.
c *参数看起来像一个单一的RGB或RGBA数字序列,应避免使用它,因为在其长度与* x *和* y *匹配的情况下,值映射将具有优先级。 如果要为所有点指定相同的RGB或RGBA值,请使用* color *关键字参数或将2D数组与单行一起提供。
Custom color: define/design the color by yourself
Delete the outline of the data point
Automatic calculation data
Use scatter to draw a series of points
Use scatter to draw and style scatter plots
Correction graphics
Set the chart title and label the axis
Set the size of tick marks
Modify label text and line thickness
condition / gallery
Draw a simple line chart
matplotlib –> math plot liberation
lib –> liberation:解放 库文件 自由 解脱 摆脱约束
data visualization –> generate data
Project1Alien Invasion
Object Glossary
Method ‘subsetsWithDup’ may be ‘static’
Passing使用/通过
list instead of Questions.Q2.Solution. Is this intentional?
flow chart –> schematic diagram
enable command
–> return string
:启用命令符
The action-operations corresponding to the active-sign should be placed outside the loop, otherwise even if the active-sign is activated, the action will still only loop once.
Switch the play button to inactive state
Reset game statistics:统计信息
Start a new game when the player clicks the play button
If the game is inactive, draw play button
Draw a color-filled button, and draw the text
Render msg
as an image and center its button
The button label can only be created once
Determine which parts of the game to run
detect whether the aliens arrive the bottom of screen
Aliens arrive at the bottom of the screen
Create a group of new aliens and place the spaceship at the bottom center of the screen
clear the list —> hide cursor –> level up
Responding to a spacecraft hit by an alien
Initialize statistics that may change during the game’s running
Track game statistics
Increase bullet speed
Detect collisions between bullets and aliens
Disappear immediately
Take corresponding measures when an alien arrives at the border
Check if there are aliens on the border and update the position of the entire group of aliens
Detect if aliens hit the edge of the screen
Create settings that indicate the direction in which aliens are moving
move the alien to the right
Create the first line of aliens
Create an alien and add it to the current line
Create an alien and calculate how many aliens can fit in a row
The distance between aliens is the width of aliens
Determine how many aliens can fit in a row
Let alien appear on the screen
Draw alien at the specified position
Store the exact location of the alien
Each alien is initially near the upper left corner of the screen
Initialize the alien and set its starting position
Review the project
Class representing a single alien
generate permanent link:提交永恒链接
Delete the disappeared bullet
Move bullet up
Update the decimal value indicating the position of the bullet
Update the position of the rect representing the bullet
Avoid calling event
repeatedly
Brief review
Press the keyboard
Release the keyboard
Limit the range of movement of the spacecraft
Respond to the button
Move the spaceship to the right
Allow constant movement
Adjust the position of the spacecraft according to the moving signs
Switch to new screen
Does not show on the screen
This code block needs to be put at the end
remove redundant parentheses
Alien invasion:外星人入侵
Armed spaceship:武装飞船
Make the most recently drawn screen visible
Monitor mouse and keyboard
Start the main loop of the game
Initialize the game and create a screen object
Redraw the screen every time it loops
Object one Aline Invasion
The program is adjusted according to the coordinates of the rectangle and screen
The screen will be constantly updated to show the new position of the element and hide the element in the original position to create a smooth movement effect.
Store the bullet position expressed as a decimal
Create a bullet object at the location of the spacecraft
Create a rectangle representing the bullet at (0,0), set the correct position
A class that manages the bullets fired by the spacecraft
Load the spaceship image and get its circumscribed rectangle
Place each ship in the bottom center of the screen
Draw the spaceship at the specified location
Set background color
Initialize the spaceship and set its initial position
Object English Short Sentences
Python Term
variable_0 = list(range(1, 1001)) –equivalence– variable_1 = [x for x in range(1, 1001)]