Write a program to enter names of employees and their salaries as input and store them in a dictionary.

Source Code

d ={}
while True:
    name = input('Enter name of Employee ')
    salary = int(input('Enter salary '))
    d[name]=salary
    ans = input('Wants to Enter more record y/n? ')
    if ans.lower()=='n':
        break
        
print(d)

Output

Enter name of Employee Deepak
Enter salary 9000
Wants to Enter more record y/n? y
Enter name of Employee Richa
Enter salary 15000
Wants to Enter more record y/n? n
{'Deepak': 9000, 'Richa': 15000}