<jupyter_start><jupyter_text>1. What does an empty dictionary's code look like?<jupyter_code>items = {}
item = dict()

print(items)
print(type(items))

print(item)
print(type(item))<jupyter_output><empty_output><jupyter_text>2. What is the value of a dictionary value with the key 'foo' and the value 42?<jupyter_code>test_dict = {'foo':42}
print(test_dict)
print("The key of our dictionary is : ",test_dict.keys())
print("The value of our dictionary is : ",test_dict.values())<jupyter_output>{'foo': 42}
The key of our dictionary is :  dict_keys(['foo'])
The value of our dictionary is :  dict_values([42])<jupyter_text>3. What is the most significant distinction between a dictionary and a list?  List List is a collection of index values pairs as that of array in c++. List is created by placing elements in [ ] seperated by commas "," The indices of list are integers starting from 0. The elements are accessed via indices. The order of the elements entered are maintained. Dictionary Dictionary is a hashed structure of key and value pairs. Dictionary is created by placing elements in { } as "key":"value", each key value pair is seperated by commas " , " The keys of dictionary can be of any data type. The elements are accessed via key-values. There is no guarantee for maintaining order.  4. What happens if you try to access spam['foo'] if spam is {'bar': 100}?<jupyter_code>spam = {'bar' : 100}
print(spam)
print(spam['foo'])<jupyter_output>{'bar': 100}<jupyter_text>5. If a dictionary is stored in spam, what is the difference between the expressions 'cat' in spam and 'cat' in spam.keys()?<jupyter_code>dict_spam = {'cat' : 'cat'}
dict_spam<jupyter_output><empty_output><jupyter_text>Entries in a dictionary can be changed. Key values can be of any hashable type (i.e. not a dict)  and types can be mixed while values can be of any type (including other dict’s),  and types can be mixed Both of these data structures can be created using comprehensions.  6. If a dictionary is stored in spam, what is the difference between the expressions 'cat' in spam and 'cat' in spam.values()? The main difference is that the key() of dictionary cannot be changed i.e. unique whereas the value 'cat' can be changed<jupyter_code>spam = {'cat':'cat'}
print(spam)
print(type(spam))
print(spam.keys())
print(spam.values())

spam = {'cat':'animal'}
print('\n')
print(spam)
print(spam.keys())
print(spam.values())<jupyter_output>{'cat': 'cat'}
<class 'dict'>
dict_keys(['cat'])
dict_values(['cat'])


{'cat': 'animal'}
dict_keys(['cat'])
dict_values(['animal'])<jupyter_text>7. What is a shortcut for the following code?if 'color' not in spam:spam['color'] = 'black'<jupyter_code>if 'color' not in spam:
    spam['color']='black'
spam
spam.popitem()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11932227829848593, 'fraction_numerical': 0.009012256669069935, 'mean_word_length': 5.638755980861244, 'pattern_counts': {'":': 1, '<': 23, '<?xml version=': 0, '>': 23, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '410888', 'license': 'Unlicense', 'n_tokens_mistral': 897, 'n_tokens_neox': 860, 'n_words': 348, 'path': 'Assignments/Assignment 5.ipynb', 'repo_name': 'Xx-ACEPREDATOR-xX/iNeuron_FSDS', 'size': '2774'}