Program No 7
Program No 7
Date-21/10/2021
Aim: Write a program to demonstrate working with dictionaries in
python.
Software: online python compiler
Algorithm:
Step1 : Enter the employee data in the list(i.e. Name, age ,
salary , company ).
Step 2 : Print the employee type.
Step3 : Print the statement of inserting employee data and print
it.
Step4 : Now print delete some of the employee data.
Step5: Delete Name and Company Name from the list and print
the modified information.
Step6 : Now try to delete the whole dictionary(i.e. Employee).
Step7 : Now print the statement and print employee.
Step8 : Output of the program.
Program:
Employee={“Name”: “Prashant Rawat”, “Age”:22,
“Salary”:10000000, “Company”: “Apple”}
print(type(Employee))
print(“Printing Employee data….”)
print(Employee)
print(“printing employee data”)
print(“Name : %s” %Employee[“Name”])
print(“Age : %d” %Employee[“Age”])
print(“Company : %s” %Employee[“Company”])
print(“Deleting some of the employee data”)
del Employee[“Name”]
del Employee[“Company”]
print(“printing the modified information”)
print(Employee)
print(“Deleting the dictionary : Employee”);
del Employee
print(“Let’s try to print it again”);
print(Employee)
Output :