Question | Click to View Answer |
What does the following code print to the console. nums = [1, 2, 3, 4, 1, 4, 1]
print(nums.count(1))
|
The |
What does the following code print to the console. cities = ["boston", "philly", "LA"]
print(len(cities))
|
The Python |
What does the following code print to the console. doubles = [22, 11, 66]
doubles.sort()
print(doubles)
|
The |
What does the following code print to the console. foods = ["pizza", "pie", "ham"]
foods.reverse()
print(foods)
|
The |
What does the following code print to the console. stuff = ["a", "b", "c"]
stuff.insert(1, "water")
print(stuff)
|
The |
What does the following code print to the console. bases = ["first", "second", "third", "fourth"]
bases.remove("fourth")
print(bases)
|
The |
What does the following code print to the console. digits = [1, 4, 2, 8, 1]
digits.remove(1)
print(digits)
|
The |
What does the following code print to the console. flowers = ["rose", "tulip"]
flowers.clear()
print(flowers)
|
The |
What does the following code print to the console. letters = ["b", "a", "y", "a"]
index = letters.index("a")
print(index)
|
The |
What does the following code print to the console. numbers = [1, 2, 3]
pos = numbers.index(44)
print(pos)
|
This code raises a When the |
What does the following code print to the console. odds = [1, 3, 5, 7]
odds.pop()
print(odds)
|
The |
What does the following code print to the console. evens = [2, 4, 6]
last_num = evens.pop()
print(last_num)
|
The |