1newDict = {1:"One",
2 2:"Two",
3 3:"Three"}
4x=newDict.setdefault(4,"Four")
5print(newDict[4])
6#returns Four
7
8newDict2 = {1:"One",
9 2:"Two",
10 3:"Three",
11 "Hello":"World"}
12y=newDict.setdefault("Hello","Yellow")
13print(newDict2["Hello"])
14#returns World
15
16dict1 = {1:"One",2:"Two"}
17x=dict1.setdefault(3,"Three")
18x=dict1.setdefault(2,"Duo")
19print(dict1)
20#prints {1: 'One', 2: 'Two', 3: 'Three'}
21
22#Therefore if value doesn't exist it is given default value, else value of key is returned.
23
1manga_names = {}
2with open('manga_list.txt', 'r') as file:
3 manga = file.readline()
4 file.readline()
5 manga_names.setdefault(manga, 0)
6 manga_names[manga] += 1
7