Create an application containing the following: 2+ user defined classes ata memb
ID: 3577130 • Letter: C
Question
Create an application containing the following: 2+ user defined classes ata members per class including at least one use of an list including at least one use of a dictionary (dictionary value should be a complex object, not just a simple value such as number or string) 2+ manipulation methods per class Demonstrate the use of if/if-else statements while loops for loops, including use of range exceptions (try except) 1 or more nested loops (while and/or for) File IO for reading and writing data Import library and use of imported library objectsExplanation / Answer
#finding max element in a given list
def findMaxOfList(a):
Max = a[0]
for i in range(1,len(a)-1):
if(Max < a[i]):
Max = a[i]
return Max
#finding most frequent values in dictionary
def sortDict(d):
dd = []
for key, value in sorted(d.values(), key=lambda x:x[1]):
dd[key]=value
return dd
d = {1:3, 4:2, 5:2, 6:2, 9:5, 10:7};
try:
print(sortDict(d))
except:
print("Unable ot sort the dict.")
a = [1,6,4,2,3]
print(findMaxOfList(a))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.