Python Key Words Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Logical operator to test whether two things are both True.

逻辑操作符,用来测试两个事物是否都是真的。

A

and

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
Assign a file object to a variable. Used with with. Let your code refer to a module under a different name (also called on alias). Used with import.
把一个文件分配给一个变量,与with一起用。让你的代码指向一个模块的别名,与import一起用。
A

as

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Stop execution of a loop.

停止一个循环的执行。

A

break

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define a custom object.

定义一个定制的对象。

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Skip balance of loop and begin a new iteration.

跳过循环的平衡并且开始一个新的迭代。

A

continue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define a function.

定义一个函数。

A

def

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Add conditional test to an if clause.

增加条件测试到一个if子句中。

A

elif

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Add an alternative code block.

增加一段可选的代码块。

A

else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Create a loop which iterates through elements of a list (or other iterable).
建立一个迭代一系列元素的循环,或建立一个迭代可迭代的元素的循环。

A

for

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
Import specific functions from a module without importing the whole module.
导入一个模块里具体的函数而不是导入整个模块。
A

from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Make a variable global in scope. (If a variable is defined in the main section, you can change its value within a function.)
在范围里制作一个全局变量。(如果一个变量定义在main部分中,你可以在一个函数里改变变量的值。)

A

global

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Create a condition. If the condition is True, the associated code block is executed. Otherwise, any elif commands are processed. If there are none, or none are satisfied, execute the else block if there is one.
建立一个条件。如果条件是真实的,与其有关系的代码块就会执行。然而任何elif命令都会处于过程中。如果这里什么也没有或者满足属于none的情况,会执行else代码块部分,如果没有else代码块就什么也不执行。

A

if

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Use code defined in another file without retyping it.

使用定义在其它文件中的代码而不用重复敲代码了。

A

import

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Used to test whether a given value is one of the elements of an object.
用来测试一个给出的值是否是一个对象元素中的一个。

A

in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Used to test whether names reference the same object.

用来测试名字是否指的是相同的对象。

A

is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Shorthand function definition. Usually used where a function needs to be passed as an argument to another function.
短函数定义。常用在把一个函数当成参数传递到另外一个函数中去。

A

lambda

17
Q

Logical negation, used to negate a logical condition. Don’t use for testing greater than, less than, or equal.
逻辑否定,用来否定一个逻辑条件。不能用来测试大于,小于,或等于。

A

not

18
Q

Logical operator to test whether at least one of two things is True.
逻辑操作符,用来测试两个事物中至少一个是不是真实的。

A

or

19
Q

Placeholder keyword. Does nothing but stop Python complaining that a code block is empty.
占位符关键字。除了阻止Python抱怨一个代码块是空的以外什么也不做。

A

pass

20
Q

Output text to a terminal.

输出文本到一个终端里。

A

print

21
Q

Return from the execution of a function. If a value is specified, return that value, otherwise return None.
返回来自一个函数的执行。如果一个值是具体的,返回该值,否则返回None。

A

return

22
Q

Execute a code block while the associated condition is True.

当与代码块有关系的条件是真实的时候,执行这段代码块。

A

while

23
Q

Get Python to manage a resource (like a file) for you.

获得Python为你管理一个资源(比如一个文件)。

A

with