I'm asking a user to input a number from the keyboard. For example users input 190, How can I compare 190 that user input to the value of the dictionary with the same value? is it equal or not?
This is my code:
my_dict = {'apple': [900, 190], 'orange': [1300, 90], 'pineapple': [550, 13], 'carrot': [600, 60], 'cucumber': [900, 30], 'egg plant': [1100, 20], 'zucchini': [1300, 10], 'garlic': [300, 70]}
for key, value in my_dict:
usernumber = input('Input your number: ')
if usernumber == value:
print("Equal")
else:
print("Not equal")
For example, if users input the number 190, how can I check this value is in dictionary or not