Python Project

Program to create a dictionary of name as a key and salary as a value for the n number of employees and display in the proper format.

Class 11th CBSE

Assignment

Q-12. Program to create a dictionary of name as a key and salary as a value for the n number of employees and display in the proper format.

Solution :- 

d={}
n = int(input(“How many Employees?”))
for a in range(n):
     emp_name = input(“Enter Employee name :- “)
     emp_sal = int(input(“Enter Employee Salary :- “))
     d[emp_name]=emp_sal
print(“Created Dictionary :- “)
print(d)
var = input(“Enter the Employee name to display its Salary :- “)
print(d[var])

Output :- 

 

TRY THIS CODE

Fun & Easy to follow
Works on all devices
Your own Pace
Super Affordable

Popular Videos

Play Video

UX for Teams

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer

Play Video

SEO & Instagram

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer