Zybooks L4 Flashcards
variable_name[3]
output will be 3rd index number of the variable value
len(variable)
output is the amount of characters of the value of the variable
string
sequence of characters (can be one letter)
string concatenation
using + to create a new string between two existing strings
Formatted string literals (f-strings)
output includes expressions, such as variables or other calculations, as part of the output text.
number = 6
amount = 32
print(f’{number} burritos cost ${amount}’)
6 burritos cost $32
list
container created by surrounding a sequence of variables or literals with brackets [ ]. Ex: my_list = [10, ‘abc’] creates a new list
- list item - element
updating list elements
my_nums = [5, 12, 20]
print(my_nums)
Update a list element
my_nums[1] = -28
print(my_nums)