from typing import List, Dict, Tuple
import typing

def soft_drinks(drinks: List[str]) -> Dict[Tuple[str], int]:
    '''Return a dictionary mapping tuples of the flavour and drink
    type from drinks to the total number of that flavour-drink
    combination
    
    >>> soft_drinks(['lemon coke', 'lemon sprite', 'cherry coke', 'lemon coke'])
    { ('lemon', 'coke'): 2, ('lemon', 'sprite'): 1, ('cherry', 'coke'): 1 }
    '''
    
    drinks_dict = {}
    
    for drink in drinks:
        drinks_tuple = tuple(drink.split())
        #print(drinks_tuple)
        if drinks_tuple not in drinks_dict:
            drinks_dict[drinks_tuple] = 0
        drinks_dict[drinks_tuple] += 1
        
    return drinks_dict

print(__name__) # This will print __main__ if we run it directly from the file
                # but will print the name of the module, dict_tuples, if imported.

# if this if-statement is true, we are running this file
# directly from the file (not importing it).
if __name__ == '__main__':
    print('We ran this file directly. No importing')
    
    # One more Python type to talk about: Tuples
    # Tuples are simply immutable lists.
    
    # normal list:
    L = [1, 'hi', True]
    
    # tuple:
    T = (1, 'hi', True) # we use round brackets
    
    # you can do with a tuple everything you can do with a list
    for e in T:
        print(e)
    
    # the only thing you can't do is change it's values
    L[0] = 50
    print(L)
    
    #T[0] = 50 # will give an error
    
    # Making a one-element tuple
    print((1)) # this will not give a tuple
    print((1,))
    
    # Reasons for having tuples
    #  1. safe - guaranteed no one can change the items
    #  2. dictionary keys have to be immutable, so we can use tuples
    #     as dict keys    
    
    # testing soft_drinks here:
    print(soft_drinks(['lemon coke', 'lemon sprite', 'cherry coke', 'lemon coke']))