Input is: book_shop = {'sci fi': 12, 'mystery': 15, 'horror': 8, 'mythology': 10, 'young_adult': 4, 'adventure':14}
Output has to be: The highest selling book genre is mystery and the number of books sold are 15
Need to solve this without using max function.
I've tried this:
book_shop = {'sci fi': 12, 'mystery': 15, 'horror': 8, 'mythology': 10, 'young_adult': 4, 'adventure':14}
largest = 0
for key, value in book_shop.items():
if largest in book_shop.values():
largest = book_shop.values()
key = book_shop.keys()
print("The highest selling book genre is ", key, " and the number of books sold are ", largest)
Output came: The highest selling book genre is adventure and the number of books sold are 0
What to do?