Python 3.x
Create an Iterator & Iterable class (AlphaDictIter) that stores a dictionary object, and iterates through the dictionary keys alphabetically (case matters/string comparison) and results in getting the corresponding values.
example usage:
my_dict = {'C':200, 'b':6, 'a':10, 'A':100}
my_iter = AlphaDictIter(my_dict)
for i in my_iter:
print(i)
##########Output###########
100 200 10 6
This assignment has been answered 6 times in private sessions.
© 2024 Codify Tutor. All rights reserved