Exam 2 Flashcards
(26 cards)
‘{0}’.format(one)
{1:^10s}.format(“name”)
Format method
ASCII of A
65
ASCII of a
97
Chr()
Chr(65)=A
ord()
ord(A)= 65
While (num > 10:)
Boolean expression
(Num = 12)
While num > 10:
Initialized look variable
Num = 12
While num > 10:
(print (num))
(Num+=1)
While body
Num = 12
(While num > 10:)
print (num)
Num+=1
While header
Function used to check whether object or variable is specified class type or data type
Isinstance
Ex. isinstance(marks, int)
This example is where the else can be omitted. When false it continues with the line after
If statement
Nested. Also know as branching structures. Indented blocks for true false
If-else statement
Short for else and if to avoid excessive indention.
Elif clause
One execution of the loop body
Iteration
Error message for input that is invalid. Reloops
Input validation.
Variable that returned to the header of the loop. Current iteration of the loop terminates.
Continue condition
How to pass through the loop
Break statement
0 evaluates to
False
1 evaluates to
True
Method used to count how many times the sub string is repeated in a specified string.
Counter variable
Variables store a value that is updated repeatedly by some calculation. Can be adding, subtracting, multiplying, dividing, concatenation, etc.
Accumulator variable
Special value that marks the end of a sequence of items. Terminates the loop
Sentinel value
Controlled repetition till a goal is reached. Can use a value to terminate or flag
Sentinel-controller repetition
Ex. Characters(0,5) generates integers from 0 but not including 5
Range checking