1/34
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
lists
the one sequence that is mutable
“““
how to do multiline strings
“
strings have ___ around them
first character
print(word[0]) prints the ____ ____ in a string
last character
print(word[-1]) prints the ___ ___ in a string
length
print(len(word)) prints the ____ of a string
0
a sequence always starts with ___
uppercase
print(text.upper()) prints a string in ____
lowercase
print(text.lower()) prints a string in ____
first
print(text.title()) capitalizes the ___ character of each word in a string
string
print(text.replace("o", "0")) replaces characters in a ___
character
print(text.count("l")) counts how many of a ____ are in a sequence
whitespace
print(text.split()) splits strings on the _____
true, false
print("World" in text) checks if characters are in the sequence and prints _____ or ____
immutable
tuples are ____
()
tuples use ____
comma
single-item tuples need a ___ inside the parentheses after the character
true, false
print("red" in colors) would result in ___ or ____
end
print(colors + ("yellow",)) would add yellow to the ___ of the sequence
[]
lists use ____
count
print(fruits.count("apple")) would ___ how many apples are in the list
replace
colors[1] = "yellow" would ____ that term with yellow in a list
add, end
colors.append("purple") would ____ purple to the ___ of the list
insert
colors.insert(0, "pink") would ___ pink at that position in a list
first
colors.remove("blue") would remove the ___ occurrence of blue in a list
remove, return, last
removed = colors.pop() would ___ and ____ the value of the ___ item
first
print(text[0:4]) would print the ____ four characters in a sequence
last
slicing does not include the ___ item
true, false
print("gram" in "Programming") would print ____ or ____
true
print(3 in [1, 2, 3, 4]) would print ___
true, at least
print(email.count("@") >= 1) would print ___ because email has ____ ___ 1 @
Hello World
print("Hello" + " " + "World") would print ___ ___
concatenation
print([1, 2] + [3, 4]) is an example of
[1, 2, 3, 4]
print([1, 2] + [3, 4]) would print ____
upperNames = [] initializes a new empty list called upperNames