Programming Assignment: Optimizing Functions of One Variable: Cost Minimization


TypeError Traceback (most recent call last)
Cell In [47], line 1
----> 1 w1_unittest.test_f_of_omega(f_of_omega)

File ~/work/w1_unittest.py:195, in test_f_of_omega(target_f_of_omega)
171 test_cases = [
172 {
173 “name”: “default_check”,
(…)
191 },
192 ]
194 for test_case in test_cases:
→ 195 result = target_f_of_omega(test_case[“input”][“omega”], test_case[“input”][“pA”], test_case[“input”][“pB”])
197 try:
198 assert result.shape == test_case[“expected”][“f_of_omega”].shape

TypeError: f_of_omega() takes 1 positional argument but 3 were given

Hi guys, I need a solution for this code…

1 Like

You should post in the right specialisation not just random, and dont just ask for the solution, but describe you issue and maybe somebody can help you!

In this case it seem you have place 3 parameters inside the function call which needs one 1 parameter!

2 Likes

Please move your thread to the correct forum for your course.
You can do this using the “pencil” icon in the thread title.

Each course has a forum in the “Course Q&A” area - then you select a course and tag with the week number.

This issue typically means you are using either an obsolete version of the notebook, or an obsolete version of the unit test .py file for that assignment.

1 Like