Types Flashcards
What is a sequence type?
A construct that contains a collection of objects.
What is len()?
A function that returns the length of a sequence type.
How do you return an object from a specified index?
Write the sequence name with brackets containing the desired index value.
What value is the first index in a sequence?
0
Can strings be changed?
No.
How is concatenation performed?
Adding two or more strings together with the + operator. Can be done with literals or variables.
What are the Format-string specification types?
s - String: Default.
d - Decimal (integer)
,d - Decimal with commas (integer)
x - hexadecimal
e - exponent notation.
f - fixed point notation
.[x]f fixed point to x spaces.
,.[x]f fixed point with commas.
What is a container?
A construct used to group related values together and contain references to other objects instead of data.
What is a list?
A mutable container created by surrounding a group of variables or literals with brackets.
What is an element?
A single list item.
What is append()?
A function that adds an item to the end of a list.
What is pop(x)?
A function that removes the item at index x in a list.
What is remove(x)?
A function that removes the first item of x value.
What is min(list)?
A function that returns the smallest value in a list.
What is sum(list)?
A function that returns the sum of all items in a list.
What is List.index(x)?
A function that returns the location of an item in a sequence.
What is list.count(x)?
A function that returns the amount of instances of x in a list.