Write a program in Python to input names of ‘n’ employees and their salary and
store the data in the form of a dictionary and find the sum of the salaries of all the
employees in python.
Answers
Answered by
0
Answer:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Answered by
0
Here's a simple program in Python to input names of 'n' employees and their salary, store the data in the form of a dictionary, and find the sum of the salaries of all the employees:
- n = int(input("Enter the number of employees: "))
- employees = {}
- for i in range(n):
- name = input("Enter the name of employee: ")
- salary = int(input("Enter the salary of employee: "))
- employees[name] = salary
- total_salary = sum(employees.values())
- print("The total salary of all employees is:", total_salary)
#SPJ3
Similar questions