What Are The 4 Parts of a While Loop?
Identify Loop Var, Initialize Loop Var, Condition While Loop, Update Loop Var
print(10 / 0)
Is an example of?
Traceback error
(cannot divide by zero)
if x > 5
print("x is greater than 5")
is an example of...
Syntax Error
What should be implemented in any code to perform iteration?
A loop
T or F:
A while loop will continue to iterate forever unless it meets a condition to stop.
True
This keyword is used to define a function.
def
This type can return True or False statements...
bool
The keyword used to check that a condition has been deemed True
if
What built in function is used to add an item to the end of a list?
append()
Len() or Length
How would you convert a string to all be uppercase?
.upper()
What is wrong with this code
s = 'Phantom Opera'
index = len(s)-1
while index >= 0
print(chr(ord(s[index])+1),end='')
index -= 1
while index >= 0:
How can your program exit a loop before it finishes iterating?
Break
How can you get an input from a user in a python program?
input()
Is this variable correct?
2DiskMove = print("Hello world!")
No!
What function must be used to take the string 'venture' out of the variable jake_dog.
jake_dog = 'adventure'jake_dog[2:]
pro = 15
app = 0
tut = 4
while not (pro < tut):
pro = pro - tut
app = app + 2
What is the final value for pro and app and tut. Also, what is the final value for (pro < tut) True or False.
pro = 3
app = 6
tut = 4
(pro < tut) = True