d={} h=int(input("how many no. you want to enter ")) for i in range(h): n=input("enter name ") no=int(input("enter no. ")) d[n]=no e=input("enter name which you want to search ") for i in d.keys(): if i==e: print("no. of",e,"is",d[i])
OUTPUT- Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> = RESTART: C:/Users/Dell/AppData/Local/Programs/Python/Python38-32/code to find no. from dict.py how many no. you want to enter 3 enter name ram enter no. 545 enter name rahul enter no. 767 enter name rohit enter no. 767 enter name which you want to search rahul no. of rahul is 767 >>>