Computer Science, asked by voilet45, 6 months ago

WAP that takes a value and checks whether the given value is part of given dictionary or not. If it is, it should print the corresponding keys otherwise print an error message.
(python)​

Answers

Answered by valeriy69
5

\small\mathsf\color{pink}{Solution\: using\: python\: 3}

s = input("input value: ")

my_dict = {

"Hello": "world",

"Learn": "python"

}

keys = list(my_dict.keys())

values = list(my_dict.values())

if s in values:

print(keys[values.index(s)])

else:

print("BEEP BEEP!")

\small\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by Anonymous
5

Answer:

s = input("input value: ")

my_dict = {

"Hello": "world",

"Learn": "python"

}

keys = list(my_dict.keys())

values = list(my_dict.values())

if s in values:

print(keys[values.index(s)])

else:

print("BEEP BEEP!")

Similar questions