What: type of data is shored in: name = 'Taylor'?
a string
How do I add something to the end of a list?
.append()
True or False: all functions are required to have return statements
def ___():
return ______
False
What are the two types of loops which we have covered?
For and while loops
"if" and 'else' are two of the three possible conditional statements, what is the other one?
What is elif?
what will x be after this code?
x = 5
x = x + 3
x = 8
How do I remove the last item from a list?
.pop()
def hello(msg):
print('Hi ' + msg)
How would I output "Hi Friend!"
what is hello('Friend!')
candy = ['Chocolate', 'M&Ms']
for i in candy:
print(i)
What is Chocolate, M&Ms?
x = 6
if x % 3 == 0:
x = x / 3
print(x)
What is 2.0?
What is wrong with this line of code?
3x = 7
= represents assignment, no variable is being assigned
How do you get 'cherry' from this dictionary:
dict = {'vegetable': 'carrot', 'fruit':'cherry'}
dict['fruit']
while True:
print('hi')
What is the issue?
infinite loop
txt = 'What's up'
for i in txt:
print(txt)
What is the output?
'What's up'
'What's up'
'What's up'
'What's up'
'What's up'
'What's up'
'What's up'
'What's up'
'What's up'
'What's up'
What kind of datatypes can you store in a list (name 3)
string, float, integer
list = [1, 2, 4, 6, 8, 9]
How would I attain the string '8' from the list?
str(list[4])
list = [90, 23, 56, 0]
How can I output: [90, 23, 56, 0, 90, 23, 56, 0, 90, 23, 56, 0]?
list *= 3, or list = list * 3