Question
I have got this feed back on this code and need some help on modify along with this feedback, please. feedback is as follows: -Your
I have got this feed back on this code and need some help on modify along with this feedback, please.
feedback is as follows:
-Your data isn't being de-duplicated as it goes onto the different lists.
-For requirement #4, why not just use the max() function for this?
-For requirement #6, you have a couple of holes in your logic that you need to contend with. What happens if someone makes exactly 24 or 26 dollars per hour? Somewhere in there, you need to apply some <= or >= logic. Also you can just take hourly rate information and multiply by 1.04, 1.05, etc. instead of the more complex way this was done.
-Requirement #7 isn't done correctly. You needed to daisy chain a bunch of and/or statements together for this.
This is the code-->
data1 = [1121, "Jackie Grainger", 22.22,
1122, "Jignesh Thrakkar", 25.25,
1127, "Dion Green", 28.75, False,
24.32, 1132, "Jacob Gerber",
"Sarah Sanderson", 23.45, 1137, True,
"Brandon Heck", 1138, 25.84, True,
1152, "David Toma", 22.65,
23.75, 1157, "Charles King", False,
"Jackie Grainger", 1121, 22.22, False,
22.65, 1152, "David Toma"]
#List of employee's number,name, and wage
employee_number = []
employee_name = []
employee_wage = []
for employee in data1: #sorting the data1 list
if type(employee) == int:
employee_number.append(employee)
elif type(employee) == str:
employee_name.append(employee)
elif type(employee) == float:
employee_wage.append(employee)
print('Employee number: ',employee_number)
print('Employee name: ',str(employee_name))
print('Employee Wage: ',employee_wage)
print('##################################################################################')
total_hourly_rate = [] #The total hourly rate list
for employee in employee_wage:
total_hourly_rate.append(1.3*employee)
print("Total Hourly Rate: ", total_hourly_rate)
#6find the maximum value in the total hourly rate list
max_value = 0 #define the max value
for employee in range(0,len(total_hourly_rate)):
if (total_hourly_rate[employee] > max_value):
max_value = total_hourly_rate[employee]
if (max_value > 37.30):
print('someones salary may be a budget concern')
underpaid_salaries = []
for employee in total_hourly_rate:
if employee > 28.16 and employee < 30.65:
underpaid_salaries.append(employee)
print('Under Paid Salaries ',underpaid_salaries)
compnay_raises = []#calculate the raise among different rates ranges
for employee in range(0,len(total_hourly_rate)):
if 22 < total_hourly_rate[employee] < 24:
total_hourly_rate [employee]= total_hourly_rate[employee] + (total_hourly_rate[employee] *0.05)
compnay_raises.append(total_hourly_rate[employee])
elif 24 < total_hourly_rate[employee] < 26:
total_hourly_rate [employee]= total_hourly_rate[employee] + (total_hourly_rate[employee] *0.04)
compnay_raises.append(total_hourly_rate[employee])
elif 26 < total_hourly_rate[employee] < 28:
total_hourly_rate [employee] = total_hourly_rate[employee] + (total_hourly_rate[employee] *0.03)
compnay_raises.append(total_hourly_rate[employee])
else:
total_hourly_rate [employee] = total_hourly_rate[employee] + (total_hourly_rate[employee] *0.02)
compnay_raises.append(total_hourly_rate[employee])
print('Raised Total Hourly Rate: ', total_hourly_rate)
print('Company Raises: ',compnay_raises)
# 7-The code here to find and compare betweeen the wage rate and company raise rates regarding multiple rates%
total_hourly_rate[employee] = (total_hourly_rate[employee]+(total_hourly_rate[employee]*0.05)) if (total_hourly_rate[employee]>22 and total_hourly_rate[employee]<24) else (total_hourly_rate[employee]+(total_hourly_rate[employee]*0.04)) if (total_hourly_rate[employee]>24 and total_hourly_rate[employee]<26) else total_hourly_rate[employee]+(total_hourly_rate[employee]*0.02)
These are the requirements for the original practice.
- Create a single list that contains the following collection of data in the order provided:
[1121,"Jackie Grainger",22.22,
1122,"Jignesh Thrakkar",25.25,
1127,"Dion Green",28.75,False,
24.32,1132,"Jacob Gerber",
"Sarah Sanderson",23.45,1137,True,
"Brandon Heck",1138,25.84,True,
1152,"David Toma",22.65,
23.75,1157,"Charles King",False,
"Jackie Grainger",1121,22.22,False,
22.65,1152,"David Toma"]
The data above represents employee information exported from an Excel spreadsheet. Whomever typed the data in originally didn't give much care to how the information was formatted, unfortunately. Each line of data has in it employee information (the whole number), the name of the employee (the string), and the employee's hourly wage (the decimal number). Some rows have extra information in them from a column in the spreadsheet that no one can remember what its purpose was. #1
Note that the presence of a couple of new data types in the above - "float" values (the numbers with the decimals in them) and "bool" [short for boolean] values (True and False).
Assume that the above information is a small sample of the company's data. Programmatically sort the information into three different lists: one for employee numbers, one for employee names, and one for employee salary information.#2
No duplicate data should make its way into the new lists.#3
For each value in the list containing hourly wage information, multiply the current value by 1.3 (since benefits are about 30% of a person's salary) and store each value in a list called total_hourly_rate.Programmatically determine the maximum value in the list and if it's over over 37.30, throw a warning message that someone's salary may be a budget concern. #4
Determine if anyone's total hourly rate is between 28.15 and 30.65. If they are, add the hourly rate a new list called underpaid_salaries. #5
For each value in the list that contains unmodified salary information, calculate a raise in dollars according to the following rules:
If the hourly rate is between 22 and 24 dollars per hour, apply a 5% raise to the current rate. If the hourly rate is between 24 and 26 dollars per hour, apply a 4% raise to the current rate.If the hourly rate is between 26 and 28 dollars per hour, apply a 3% raise to the current rate. All other salary ranges should get a standard 2% raise to the current rate.
Add each new value you calculate to a new list called company_raises. #6
Design your own complex condition with no fewer than four different truth tests in it (all conditions must be on one line, in other words). Above your condition, write out in comments the exact behavior you are implementing with Python. #7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started