Help with code

hey im trying to study how to program with python.
can somebody please help me and point about all the issue in the code…

its a suppose to be a task from here

Welcome to the forums :slight_smile:

I see a potential error in your code. Before I mention it, what do you think is the problem or could be the problem?

I mention this because even when asking for help it’s important to form a hypothesis. As your problems become more complex, these hypotheses can even allow whoever is helping you to be super efficient and find the heart of the matter right away.


i dont know… i look at the code something like 10 time, and i dont understand… can you please point in witch line do you see an error?

So the trick is to try to run your functions.

To show you, I ran a test with some dummy invocations:


runs ok!


print(get_work(15, 15, 200))

gives this error:

Traceback (most recent call last):
  File "/Users/argos/Downloads/", line 35, in <module>
    print(get_work(15, 15, 200))
  File "/Users/argos/Downloads/", line 30, in get_work
    force = get_work(* distance)
TypeError: get_work() argument after * must be an iterable, not int

Now we have a great clue as to what the issue is! It is telling you that the error is in force = get_work(* distance). See if you can solve it from here. You can always come back and ask for more help, but try it for yourself first now that you have this clue.

General side note: you can write a function with a million errors in it, and if you never run the function, the compiler won’t tell you there’s a problem! It’s always good to test functions as you build them. Python’s error messages are some of the clearest around, so they’re a good learning tool.