Write a program in Python to declare two empty lists one is for name and one for salaries. Within the for loop ask for employees name and their salaries and append them into the list accordingly. Find out the total salary using accumulation concept within the for loop.
Output : Both of the lists with their items and the total salary.
name = [] salary = [] n = int(input("Enter number of employees: ")) for i in range(n): name.append(input("Enter name of employee: ")) salary.append(float(input("Enter salary of employee: "))) totalSalary = 0 for x in salary: totalSalary += x print(name) print(salary) print("Total salary of all employees:",totalSalary)
Get Answers For Free
Most questions answered within 1 hours.