# Facing an error while passing args

**URL:** <https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443>\
**Category:** Calculus for Machine Learning and Data Science\
**Tags:** week-module-1\
**Created:** [April 23, 2023, 5:36pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443 "2023-04-23T17:36:31Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 23, 2023, 5:36pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/1 "2023-04-23T17:36:31Z")

</div>

I’m facing the following TypeError. Please, someone help me out. I have been trying to fix this issue for quite some time now. Although I don’t have that level of expertise in Machine Learning as of now.  
It will be really helpful for me.

Course name: Calculus for ML and Data Science  
Week 1  
Exercise 4  
**ERROR:**

 ![image](https://global.discourse-cdn.com/dlai/original/3X/e/2/e218bf8e19c080aa22253d74fc94198df4924dd2.png)

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 24, 2023, 1:15am UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/2 "2023-04-24T01:15:10Z")

</div>

Hi @MAYANK4, welcome to the community!

Note: Please remove your **code** in your posts because it is against the honor code.

The function **dLdOmega\_of\_omega\_array** should only accept the _omega\_array_ input. Thus, kindly remove all the **prices\_A** and **prices\_B** that you added in that cell. In general, you should only edit/replace the lines of code inside the “START CODE HERE” and “END CODE HERE”

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 24, 2023, 9:20am UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/3 "2023-04-24T09:20:46Z")

</div>

Okay sorry for that. I’ve removed the code snippet from there. But I’m getting this error now:

 ![image](https://global.discourse-cdn.com/dlai/original/3X/8/a/8ac9ddef8028f1e6dd3e56ef393c5204b37fc9b1.png)

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 24, 2023, 10:23am UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/4 "2023-04-24T10:23:09Z")

</div>

Based on the last sentence of the error message,

> TypeError: L\_of\_omega() missing 2 required positional arguments: ‘prices\_A’ and ‘prices\_B’

I think you also added **prices\_A** and **prices\_B** as inputs in the **L\_of\_omega** function. Instead, L\_of\_omega function should only accept **omega** as its input.

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 24, 2023, 4:40pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/5 "2023-04-24T16:40:21Z")

</div>

You are right. I had passed two extra arguments before. Fixing it resolved the issue. But two test cases are still failing in the same exercise.

 ![image](https://global.discourse-cdn.com/dlai/original/3X/e/4/e4a438898df06c3a65bb4e7ad640fb027defabc9.png)

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 25, 2023, 1:36am UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/6 "2023-04-25T01:36:05Z")

</div>

Great. There are just some minor errors remaining.

Can you send me your code (.ipynb) privately? Click my logo/name then click **Message**

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 25, 2023, 3:42pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/7 "2023-04-25T15:42:19Z")

</div>

Yes, I’ll share it with you.

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 26, 2023, 2:15am UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/8 "2023-04-26T02:15:03Z")

</div>

Hi.

Some errors arise because you used **jax** in Exercise 1. Do not use jax in Exercise 1. Instead, your first 2 lines of prices\_A and prices\_B should work.

> prices\_A = …  
> prices\_B = …

In the notebook, you combined those procedures (obtaining data from df and setting to numpy array with float32 dtype) in just 2 lines. Thus, you can either separate those procedures into 4 lines, or keep your original 2 lines then delete the 3rd and 4th lines of code.

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 26, 2023, 3:23pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/9 "2023-04-26T15:23:30Z")

</div>

It’s still showing that two test cases have failed. But I just went through the code once again and found out that exercise 2 is producing an error while passing arguments to the test function.  
Would you please be able to check that once?

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 26, 2023, 4:07pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/10 "2023-04-26T16:07:03Z")

</div>

I need to see how you corrected Exercise 1. Can you send me your new notebook privately again?

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 26, 2023, 4:23pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/11 "2023-04-26T16:23:23Z")

</div>

Nothing happened here.

---

<div class="post-metadata">

**Author:** ![yjcb22](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/yjcb22/32/127956_2.png) [@yjcb22](https://community.deeplearning.ai/u/yjcb22)\
**Post date:** [April 26, 2023, 4:24pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/12 "2023-04-26T16:24:41Z")

</div>

better in a private message 😉

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 26, 2023, 5:04pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/13 "2023-04-26T17:04:52Z")

</div>

Hmm… Your solution notebook looks correct and I can’t seem to recreate the error in Exercise 2 even if I copy your solutions. Can you try restarting your notebook then rerun?

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 26, 2023, 5:16pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/14 "2023-04-26T17:16:53Z")

</div>

I tried, but nothing happened. The error says that omega is not defined.

---

<div class="post-metadata">

**Author:** ![jonrico](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/jonrico/32/44347_2.png) [@jonrico](https://community.deeplearning.ai/u/jonrico)\
**Post date:** [April 27, 2023, 12:22am UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/15 "2023-04-27T00:22:22Z")

</div>

I noticed you edited this line and inserted **omega** inside f\_of\_omega.

![Screen Shot 2023-04-27 at 8.18.38 AM](https://global.discourse-cdn.com/dlai/original/3X/f/2/f2ab8e26645faa2a82b8d94704bc4716f39f08b7.png)

In general, do not edit lines in the notebook unless there is a “START CODE HERE” and “END CODE HERE” instructions. Let me know if that works.

---

<div class="post-metadata">

**Author:** ![MAYANK4](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MAYANK4](https://community.deeplearning.ai/u/MAYANK4)\
**Post date:** [April 27, 2023, 3:43pm UTC](https://community.deeplearning.ai/t/facing-an-error-while-passing-args/313443/16 "2023-04-27T15:43:47Z")

</div>

Sorry, I really messed that up. But the code is working now. Thanks for your help, Jonathan!
