<jupyter_start><jupyter_text>List<jupyter_code>my_list_1 = [1, 2, 3, 4]
type(my_list_1)
my_list_2 = [1, 2.4, 'a string', ['a string in another list', 5]]
my_list_2
my_list_3 = [2+3, 5*3, 4**2]
my_list_3
my_str="A string"
list(my_str)<jupyter_output><empty_output><jupyter_text>list operators<jupyter_code>[1, 2, 3] + [4, 5, 6]

[1, 2, 3] * 3
1 in my_list_2
['a string in another list', 5] in my_list_2
'a string in another list' in my_list_2
7 not in my_list_2
# Make a list of stop codons
stop_codons = ['UAA', 'UAG', 'UGA']

# Specify codon
codon = 'UGG'

# Check to see if it is a start or stop codon
if codon == 'AUG':
    print('This codon is the start codon.')
elif codon in stop_codons:
    print('This codon is a stop codon.')
else:
    print('This codon is neither a start nor stop codon.')<jupyter_output>This codon is neither a start nor stop codon.<jupyter_text>List indexing<jupyter_code>my_list = [1, 2.4, 'a string', ['a string in another list', 5]]
my_list[2]
my_list[0]
my_list[3]
my_list[3][0]
my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_list[0:12]
len(my_list)
my_list[4]
len(my_list)
my_list[-1]
my_list[-5]<jupyter_output><empty_output><jupyter_text>slicing<jupyter_code>my_list[0:5]

my_list[3:1000]
my_list[0:-3]
my_list[0::2]
my_list[::2]
my_list[0:10:2]
my_list[::-1]
print(my_list[2::2])
print(my_list[2:-1:2])
print(my_list[-2::-2])
print(my_list[-2:2:-2])
print(my_list[2:2:-2])
# Extract evens
evens = my_list[::2]

# Cut off end values
evens_without_end_values = evens[1:-1]

evens_without_end_values<jupyter_output><empty_output><jupyter_text>Mutability<jupyter_code>my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_list[3] = 'four'

my_list
a = 689
print(id(a))

a = 690
print(id(a))
print(id(my_list))

my_list[0] = 'zero'
print(id(my_list))<jupyter_output>4418155520
4418155520<jupyter_text>Aliasing<jupyter_code>my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_list_2 = my_list     # copy of my_list?
my_list_2[0] = 'a'

my_list_2
my_list
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_list_2 = my_list[:]
my_list_2[0] = 'a'

my_list_2
my_list<jupyter_output><empty_output><jupyter_text>tuple<jupyter_code>my_tuple = (0,)

not_a_tuple = (0) # this is just the number 0 (normal use of parantheses)

type(my_tuple), type(not_a_tuple)

my_list = [1, 2.4, 'a string', ['a sting in another list', 5]]

my_tuple = tuple(my_list)

my_tuple
my_tuple[1] = 7
my_tuple[3][0]=7
my_tuple
my_tuple[3] = ['a', 'new', 'list']
my_tuple = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

# Reverse
my_tuple[::-1]
my_tuple[1::2]
my_tuple + (11, 12, 13, 14, 15)

5 in my_tuple
my_tuple = (1, 2, 3)
(a, b, c) = my_tuple

a
b
c
a, b, c = my_tuple

print(a, b, c)<jupyter_output>1 2 3
{'fraction_non_alphanumeric': 0.1707134852446769, 'fraction_numerical': 0.0788195741501681, 'mean_word_length': 5.4842615012106535, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '71120', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1286, 'n_words': 316, 'path': 'lesson_05.ipynb', 'repo_name': 'Alixbuu/bootcamp', 'size': '2677'}