-1

The code is supposed to work out how much is made a in week, however I cannot work out how to make the end result 'None'. It is multiplying the hours worked a week by the hours worked each day. Any help would be great.

def WeeklyPay(t,z,x,c,v,b,n):
    WeeklyPayOverall = (t*(z,x,c,v,b,n,))






employeeName = input("What is your name : ")
hourlyPayRate = int(input("What is your hourly pay : "))
hoursWorkedMonday = int(input("How many hours did you work on Monday : "))
hoursWorkedTuesday = int(input("How many hours did you work on Tuesday : "))
hoursWorkedWednesday = int(input("How many hours did you work on Wednesday : "))
hoursWorkedThursday = int(input("How many hours did you work on Thursday : "))
hoursWorkedFriday = int(input("How many hours did you work on Friday : "))
hoursWorkedSaturday = int(input("How many hours did you work on Saturday : "))
hoursWorkedSunday = int
(input("How many hours did you work on Sunday : "))

result = (WeeklyPay(hoursWorkedMonday,hoursWorkedTuesday,hoursWorkedWednesday,hoursWorkedThursday,hoursWorkedFriday,hoursWorkedSaturday,hoursWorkedSunday))


print(employeeName,"Your Weekly pay is £", result)
Bucket
  • 7,415
  • 9
  • 35
  • 45
Andrewreee
  • 11
  • 1
  • 4
    Your function doesn't return anything, so `None` is returned by default. `t*(z,x,c,v,b,n,)` is likely not doing what you think it is doing. That will generate a tuple repeated `t` times. For example, `3*(1, 2) == (1, 2, 1, 2, 1, 2)` – Patrick Haugh Sep 06 '18 at 17:50

1 Answers1

1

You aren't returning the value; you're just saving it to a local variable and (implicitly) returning None. You also need to actually add up the hours worked on each day. You want

def WeeklyPay(t, z, x, c, v, b, n):
    return t * (z + x + c + v + b + n)

Finally, you are missing a parameter; you only have 7 (hourly rate and 6 daily hours), but you need 8 (hourly rate and 7 daily hours).

When you call the function, you also need to pass hourlyPayRate as the first argument. You are currently only passing in the daily hours worked.

chepner
  • 497,756
  • 71
  • 530
  • 681