Respuesta :
Answer:
total_hours = 0
total = 0
n = int(input("Enter the number of employees: "))
for i in range(n):
pay = int(input("Enter the pay per hour in cents of the " + str(i+1) + ". employee: "))
for j in range(5):
hour = int(input("Enter the work hour in " + str(j+1) + ". day: "))
total_hours +=hour
total += pay * total_hours
total_hours = 0
print(total)
Explanation:
Initialize the total hours and total as 0
Ask the user to enter the number of employees
Create a nested for loop. The outer loop iterates depending on the number of employees. The inner loop iterates for each work day.
Inside the outer loop, ask the employee's pay per hour. Then, inside the inner loop, ask for the work hours for 5 days. Sum the hours and assign the value to total hours.
When inner loop is done, multiply the pay with total hours to calculate the pay and add this value to the total for each employee. Also, set the total hours as 0 (For the next employee, total hours will be zero at the beginning).
When the loops are done, print the total
Following are the python program to the given question:
Program Explanation:
- Defining "x" variable that inputs value.
- Defining "t" variable that initializes the value with "0".
- In the next step, a for loop that checks the value in the range of "x", inside the loop a "pay_per_hour, hour" variable is declared in which it inputs value.
- In the hour variable, it adds value to the list, and defines the "t" variable that adds the input's value, and uses a print method that print's its value with a message.
Program:
x = int(input())#defining an integer variable that input value
t= 0#defining a variable that initializes the value
for n in range(x):#defining a loop that checks input value range
pay_per_hour = int(input())#defining a variable pay_per_hour that inputs value
hour = list(map(int, input().strip().split()))#defining hour variable that input and store value in list
t = t + (pay_per_hour*sum(hour))#defining a t variable that adds inputs value
print('total:', t)#defining print method that prints t value with message
Output:
Please find the attached file.
Learn more:
brainly.com/question/13699017
