Module 3 Flashcards

1
Q

an instruction that a Python interpreter can execute

A

Statement

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

Python statement ends with the token NEWLINE character. But we can extend the statement over multiple
lines using line continuation character (). This is known as an explicit continuation.

A

Multi-Line Statements

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

We can use parentheses () to write a multi-line statement. We can add a line continuation statement inside
it. Whatever we add inside a parentheses () will treat as a single statement even it is placed on multiple lines

A

Implicit continuation

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

contain (groups of) other statements; they affect or control the execution of those
other statements in some way.

A

Compound Statements

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

What are the Five compound statements?

A

if, while, for, try and with

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

It is a control flow statement that will execute statements under it if the condition is
true. Also known as a conditional statement.

A

if statement

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

repeatedly executes a code block while a particular
condition is true. Also known as a looping statement.

A

while statements

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

we can iterate any sequence or iterable variable. The
sequence can be string, list, dictionary, set, or tuple. Also known as a looping statement.

A

for statement

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

specifies exception handlers

A

try statements

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

Used to cleanup code for a group of statements, while the with statement allows
the execution of initialization and finalization code around a block of code.

A

with statements

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

Apart from the declaration and calculation statements, Python has various simple statements for a specific
purpose.

A

Simple Statements

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

is a null operation. Nothing happens when it executes. It is useful as a placeholder when a statement
is required syntactically, but no code needs to be executed.

A

The pass statement

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

are used to compute and write a value. An expression statement
evaluates the expression list and calculates the value.

A

Expression statements

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

used to delete objects/variables.

A

The del statement

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

we can return a value from a function when
called.

A

The return statement

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

contains the variable to delete separated by a comma.

A

target_list

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

used to import modules. We can also import individual classes from a module.
Python has a huge list of built-in modules which we can use in our code.

A

The import statement

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

used inside the loop to exit out of the loop

A

break Statement

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

skip the current iteration and move to the next iteration.

A

continue Statement

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

Terminate the current loop. Use the break statement to
come out of the loop instantly.

A

break

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

Skip the current iteration of a loop and move to the next
iteration

A

continue

22
Q

Do nothing. Ignore the condition in which it occurred and
proceed to run the program as usual

A

pass

23
Q

The comments are descriptions that help programmers to understand the functionality of the program. Thus,
comments are necessary while writing code in Python.

A

Python Comments

24
Q

There is no separate way to write a ____________. Instead, we need to use a hash sign at the beginning
of each comment line to make it a ___________

A

Multi-Line Comments

25
Q

are indicated by a hash sign(#)

A

Single-line Comment

26
Q

a comment on the same line as a statement. Inline comments should be separated
by at least two spaces from the statement. They should start with a # and a single space.

A

Inline Comments

27
Q

used to provide descriptions of files, classes, and functions

A

Block comments

28
Q

We can use multi-line strings (triple quotes) to write multi-line comments. The quotation character can
either be ‘ or “. Python interpreter ignores the string literals that are not assigned to a variable.

A

Using String Literals for Multi-line Comments

29
Q

describe Python classes, functions, constructors, methods. The docstring comment
should appear just after the declaration.

A

Docstring Comments

30
Q

built-in module to get the list of keywords. Also, this module
allows a Python program to determine if a string is a keyword.

A

keyword module

31
Q

reserved words that have a special meaning

A

Python keywords

32
Q

Apart from a keyword module, we can use the _________ to get the list of
keywords

A

help() function

33
Q

It return a sequence containing all the keywords defined for the interpreter.

A

keyword.kwlist

34
Q

Return True if s is a Python soft keyword.

A

keyword.issoftkeyword(s)

35
Q

Sequence containing all the soft keywords defined for the interpreter.

A

keyword.softkwlist

36
Q

used to represent truth values, known as boolean values

A

True and False

37
Q

returns True if both expressions are True. Otherwise, it will
return. False.

A

and keyword

38
Q

returns a boolean True if one expression is true, and it returns False if
both values are false

A

or keyword

39
Q

returns boolean True if the expression is false.

A

not keyword

40
Q

returns return True if the memory address first value is equal to the second value.

A

is keyword

41
Q

returns True if it finds a given object in the sequence (such as list, string).

A

in keyword

42
Q
A
43
Q
A
44
Q
A
45
Q
A
46
Q
A
47
Q
A
48
Q
A
49
Q
A
50
Q
A