# The Nile Test Functions

Here is the link to the exercise I am working on:

The code looks fine as it looks just like the walkthrough but for some reason it doesn’t register that I am telling it to expect multiple arguments. So when I run the test it says the following:

calculate_driver_cost() doesn’t expect multiple driver arguments

Here is my code, I don’t see what’s wrong.

def calculate_driver_cost(distance, *drivers):
cheapest_driver = None
cheapest_driver_price = None
for driver in drivers:
driver_time = driver.speed * distance
price_for_driver = driver.salary * driver_time
if cheapest_driver is None:
cheapest_driver = driver
cheapest_driver_price = price_for_driver
elif price_for_driver < cheapest_driver:
cheapest_driver = driver
cheapest_driver_price = price_for_driver
return cheapest_driver_price, cheapest_driver

# Test the function by calling

test_function(calculate_driver_cost)

1 Like

I actually completed the rest of the exercise and got the same error for the last part where we pass in a dictionary and need to use **args. There has to be some bug going on here. My code looks the same.

Hello, @xavierdavis869921579. Welcome to the forum! Could you post your code using the `</>` button, so we can see it in the way you have it formatted in the code editor? See the following regarding pasting code into a forum post:

Thanks!

In elif line, it should be price_for_driver< cheapest_driver_price

1 Like

Hi,
I have the same problem

``````def calculate_driver_cost(distance,*drivers):
cheapest_driver = None
cheapest_driver_price = None
for driver in drivers:
driver_time = driver.speed * distance
price_for_driver = driver.salary * driver_time
if cheapest_driver is None:
cheapest_driver = driver
cheapest_driver_price = cheapest_driver_price
elif price_for_driver < cheapest_driver_price:
cheapest_driver = driver
cheapest_driver_price = cheapest_driver_price
return cheapest_driver_price, cheapest_driver
``````

the test result is

``calculate_driver_cost() doesn't expect multiple driver arguments``
2 Likes

I have also been having the same issues.
`calculate_driver_cost() doesn't expect multiple driver arguments calculate_money_made() doesn't expect multiple trip keyword arguments`

I watched the video walkthrough and my code is essentially the same.

Hi, had exactly the same problem here, i didn’t understand why.
I tried a few things, copying Driver class from test.py to script.py, and it appears the TypeError which raises

calculate_driver_cost() doesn’t expect multiple driver arguments

is due to the ` elif price_for_driver < cheapest_driver:`. Effectively, price_for_driver is an int, and cheapest_driver is a tuple, can’t be compared… we should have coded that instead: `elif price_for_driver < cheapest_driver_price:`

Problem solved ^^

1 Like