Write a Python code

Learning Goal: I’m working on a python question and need the explanation and answer to help me learn.

Write a code where you provide the names and working hours of 5 workers as TWO separate lists as Workers=[Ahmad, Ali, Muhammad, Salih, Waleed], Worker_hours=[20, 45, 32, 38, 50]. The hourly rate is fixed to $2.75. For these workers you have to write a report saying:

For [worker] , who worked for [hours], including [over time] Hours of overtime, for an hourly rate of: [hourly rate] and overtime rate: [overtime rate], his gross pay is: [gross pay].

Note that gross pay is calculated as: Hours * Hourly Rate

  • An important point is that pay above 40 will get an hourly wage 1.5 time the regular wage
  • Hint: use len(list([list_name]) to find the number of elements in the list and then make use of while statement. Also note that, in order you refer a particular list element we use listname[index], e.g. in Workers list, Ahmad is at index 0, therefore to refer to Ahmad or the first element we use Workers[0].
  • find the cost of your paper

    This question has been answered.

    Get Answer