1/15
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What data type is: 1
Integer
What data type is: 1.0
Float
What data type is: "1.0"
String
What data type is: True
Boolean
If the user types in Fred, what will the code print out?
"What are you doing, Fred?"
What is the error in the code on line 18?
Missing colon at the end of the if statement if (survivor == "A" or survivor == "a")
What is the error in the code on line 18?
Missing equals sign in the if statement if (survivor == "A" or survivor == "a)
What is the error in the code on line 17?
Missing input function name. survivor input("What type of survivor are you? A, T, I or M: ")
What is the error in the code on line 18?
Missing equals sign for comparison in the if statement if (survivor == "A" or survivor = "a"):
When will this code stop asking you "What type of survivor are you? A, T, I or M:"?
The code will stop asking "What type of survivor are you? A, T, I or M:" when the user inputs A, a, T, or t
What will this code print out?
survivors = ['A', 'T', 'I']
i = 0
for survivor in survivors:
print(i)
i += 1
0, 1, 2
What does line 98 do? What is it equivalent to?
i += 1
Line 98 increments the counter i by 1. It's equivalent to i = i + 1
When will this code accept the user input?
food = ["Burger", "burger", "Shake", "Fries"]
userinput = input("What would you like today?")
if (userinput in food):
print("Great I added a", user_input)
Never, it compares the user input against the list values and will do different things based on the content.
What should I set the index to so that the code will print out True?
myList = [0, 1.0, "Fred", True]
index =
3
What list is not defined correctly and why?
list1 = [ ]
list2 =
list3 = [0,1,2,3]
list4 = ["0 1 2 3"]
list3 = [0123] is not defined correctly, because it’s missing commas between each value
Does ORDER matter for importing a library?
import math
MRES = math.ceil(totalCalories / caloriesPerMRE)
Yes, the order matters.