<jupyter_start><jupyter_text>Module 2 Video 8: Tuples and Dictionaries**Python for the Energy Industry**This lesson covers a couple of other ways of storing data in Python that you will come across: tuples and dictionaries. TuplesTuples function very similarly to lists, with one key difference: once a tuple is created, it cannot be modified. Tuples are created using round, rather than square brackets.<jupyter_code>counts = (3,5,7,10)
print(counts)
# Indexing works the same for tuples as lists
print('First item:', counts[0])
print('Second item:', counts[1])
# Trying to modify the tuple gives an error

# uncomment the following line:
# counts[0] = 4<jupyter_output><empty_output><jupyter_text>DictionariesDictionaries store pairs of variables: the 'key' and the 'value'. The key can be used instead of an index to access the value. Here's an example dictionary for storing the cubic capacity of different vessels:<jupyter_code>capacities = {'ABIOLA': 47261, 'ABLIANI': 124518, 'ACACIA': 14570}

print(capacities['ABLIANI'])<jupyter_output>124518<jupyter_text>It is straightforward to add new items to a dictionary:<jupyter_code>capacities['A STAR'] = 333924

print(capacities)<jupyter_output>{'ABIOLA': 47261, 'ABLIANI': 124518, 'ACACIA': 14570, 'A STAR': 333924}<jupyter_text>Using a loop to iterate over a dictionary will iterate over the keys:<jupyter_code>for vessel in capacities:
    print(vessel, 'capacity =', capacities[vessel])<jupyter_output>ABIOLA capacity = 47261
ABLIANI capacity = 124518
ACACIA capacity = 14570
A STAR capacity = 333924<jupyter_text>The keys and values can also be accessed separately from a dictionary:<jupyter_code>print('keys -', list(capacities.keys()))

print('values -', list(capacities.values()))<jupyter_output>keys - ['ABIOLA', 'ABLIANI', 'ACACIA', 'A STAR']
values - [47261, 124518, 14570, 333924]