Exam 2 Flashcards

(26 cards)

1
Q

‘{0}’.format(one)

{1:^10s}.format(“name”)

A

Format method

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

ASCII of A

A

65

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

ASCII of a

A

97

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

Chr()

A

Chr(65)=A

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

ord()

A

ord(A)= 65

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

While (num > 10:)

A

Boolean expression

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

(Num = 12)

While num > 10:

A

Initialized look variable

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

Num = 12
While num > 10:
(print (num))
(Num+=1)

A

While body

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

Num = 12
(While num > 10:)
print (num)
Num+=1

A

While header

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

Function used to check whether object or variable is specified class type or data type

A

Isinstance

Ex. isinstance(marks, int)

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

This example is where the else can be omitted. When false it continues with the line after

A

If statement

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

Nested. Also know as branching structures. Indented blocks for true false

A

If-else statement

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

Short for else and if to avoid excessive indention.

A

Elif clause

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

One execution of the loop body

A

Iteration

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

Error message for input that is invalid. Reloops

A

Input validation.

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

Variable that returned to the header of the loop. Current iteration of the loop terminates.

A

Continue condition

17
Q

How to pass through the loop

A

Break statement

18
Q

0 evaluates to

19
Q

1 evaluates to

20
Q

Method used to count how many times the sub string is repeated in a specified string.

A

Counter variable

21
Q

Variables store a value that is updated repeatedly by some calculation. Can be adding, subtracting, multiplying, dividing, concatenation, etc.

A

Accumulator variable

22
Q

Special value that marks the end of a sequence of items. Terminates the loop

A

Sentinel value

23
Q

Controlled repetition till a goal is reached. Can use a value to terminate or flag

A

Sentinel-controller repetition

24
Q

Ex. Characters(0,5) generates integers from 0 but not including 5

A

Range checking

25
Three points for a good loop
Initialization Test for entry/exit Change in loop variable
26
A loop that never becomes false which results in a loop that never ends
Infinite loop