Class 11th IP (065)
Write a Python program to Find Highest and Lowest Value in a Dynamic Dictionary
SOLUTION..
data = {} while True: print("\n--- Dictionary Menu ---") print("1. Add / Update Element") print("2. Display Dictionary") print("3. Find Highest & Lowest Value") print("4. Exit") choice = int(input("Enter your choice: ")) if choice == 1: key = input("Enter key: ") value = int(input("Enter numeric value: ")) data[key] = value print("Element added/updated successfully") elif choice == 2: if len(data) == 0: print("Dictionary is empty") else: print("Dictionary:", data) elif choice == 3: if len(data) == 0: print("Dictionary is empty") else: highest = None lowest = None for v in data.values(): if highest is None or v > highest: highest = v if lowest is None or v < lowest: lowest = v print("Highest Value:", highest) print("Lowest Value:", lowest) elif choice == 4: print("Program terminated") break else: print("Invalid choice")


