<jupyter_start><jupyter_text>Set<jupyter_code># setName = set([1,2,3,4,5])
firstSet = set()
firstSet
type(firstSet)
firstSet.add(50)
firstSet
secondSet = set()
secondSet.add(80)
secondSet
print(firstSet.union(secondSet))
print(firstSet.intersection(secondSet))
print(secondSet.difference(firstSet))
print(firstSet.difference(secondSet))
firstSet
10 in firstSet
firstSet<jupyter_output><empty_output><jupyter_text>Dictionary<jupyter_code># dictName = {key1:value1, key2:value2}
# a = {}
# var = dict[]
firstDict = {"Solomon":10, "Eva":20}
firstDict
type(firstDict)
firstDict["John"] = 15
firstDict
firstDict["Jane"] = 25
firstDict
print(firstDict["Jane"])
print(secondDict)
print(firstDict)
secondDict[123] = "location"
secondDict
firstDict["Jobs"] = ("Doctor","Lawyer","Banker")
firstDict
print(firstDict.keys())
print(firstDict.values())
thirdDict = firstDict.copy()
thirdDict
thirdDict.update(secondDict)
thirdDict
print(firstDict)
print(secondDict)
thirdDict.items()
thirdDictBackup = thirdDict.copy()
thirdDict.clear()
thirdDict
thirdDict = thirdDictBackup.copy()
thirdDict<jupyter_output><empty_output><jupyter_text>Example<jupyter_code>firstSet
firstSet.add("solomon")
firstSet<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14591920857378401, 'fraction_numerical': 0.021434460016488046, 'mean_word_length': 11.262626262626263, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '446531', 'license': 'MIT', 'n_tokens_mistral': 458, 'n_tokens_neox': 441, 'n_words': 67, 'path': '6. Set and Dictionary.ipynb', 'repo_name': 'SolomonMbak/Python-practical-introduction--beginner-to-advanced-', 'size': '1213'}