Question

Write a program in Python to declare two empty lists one is for name and one...

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.

Homework Answers

Answer #1
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)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question1: Write a Python Program that asks for the grades of 5 quizzes and then prints...
Question1: Write a Python Program that asks for the grades of 5 quizzes and then prints the highest grade. [6 Marks] Question2: Write a Python Program that does the following tasks. [8 Marks] Create an empty list Ask the user for 5 positive numbers and append them to the list Find and print the sum of all the numbers in the list Delete the last element from the list and then print the list Question3: Consider you have the following...
Write a PYTHON program for the following: A dictionary courses lists summer school classes a student...
Write a PYTHON program for the following: A dictionary courses lists summer school classes a student is taking, along with information about the classes. For example, courses = { "CS 101" : { "full_name" : "Intro to CS with Python", "instructors" : [ "Sally", "Johnson" ], "tas" : ["Bob", "Joe",..., "Elroy"], "num_homeworks" : 6, "num_exams" : 2 }, "SPAN-SAA" : { "name" : "Beginning Spanish I", ... }, ... } Write a loop that computes the total number of homeworks...
Write a program in Python that acts as a contact taker. It doesn't need to loop,...
Write a program in Python that acts as a contact taker. It doesn't need to loop, just take one contact. So the program will start and ask the user for their name, their address, and phone number. The output will look like this: Name Address Phone number
IN PYTHON: Write a program where the user enters a name. Using the read function, check...
IN PYTHON: Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list
Write a Python program to create a dictionary from two lists without losing duplicate values. If...
Write a Python program to create a dictionary from two lists without losing duplicate values. If there is more values in the key list, then provided key should return an empty set if there is no match. (Hint: use defaultdict) Example: class_list = ['Class-V', 'Class-VI', 'Class-VII', 'Class-VIII','Class-IX'] id_list = [1, 2, 2, 3] Output: assuming you store the values in a data structure named temp print(temp["Class-V"]) # {1} print(temp["Class-IX"]) # set() can you please try and do on google colab
Write a Python program to ask how many elements do users want to create in a...
Write a Python program to ask how many elements do users want to create in a list, then let the user create 2 lists with the number of elements previously entered. Then create and display all combinations of letters, selecting each letter from a different key in a dictionary. Example: How many elements? 2 List 1 = ['a', 'b'] List 2 = ['c', 'd'] Output: ac ad bc bd
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items separated by a space. Read the list. Use a for loop to write (use echo) the items to a file called shopping_list. You should use >> to append the output to the file, so each time the script is run the list should get longer. After the for loop finishes, display (use cat) the contents of the shopping list with 1 item per line....
Create a program that allows the user to input a list of first names into one...
Create a program that allows the user to input a list of first names into one array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. The output should be a list of emial addresses where the address is of the following form: [email protected] Declare FirstName[100] as String Declare LastName[100] as String Declare email as String Declare K as Integer Declare index as Integer Write "Enter first and last name." Write...
The last thing we will learn about in python is functions. Functions are a great way...
The last thing we will learn about in python is functions. Functions are a great way to organize your program - we use them to write code that is executed only under certain circumstances - for instance when you're using Amazon, any of the following are likely functions within their program: - Add item to cart, determine arrival date,  create a new address, compute taxes, compute shipping charges, charge credit card Because you can write a task-specific function once, and ensure...
For this assignment, you need to submit a Python program that gathers the following employee information...
For this assignment, you need to submit a Python program that gathers the following employee information according to the rules provided: Employee ID (this is required, and must be a number that is 7 or less digits long) Employee Name (this is required, and must be comprised of primarily upper and lower case letters. Spaces, the ' and - character are all allowed as well. Employee Email Address (this is required, and must be comprised of primarily of alphanumeric characters....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT