# Introduction and General Issues with Python

**URL:** <https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178>\
**Category:** AI Discussions\
**Tags:** project, ai-discussions\
**Created:** [November 5, 2026, 3:52pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178 "2026-11-05T15:52:48Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 5, 2026, 3:52pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/1 "2026-11-05T15:52:48Z")

</div>

Hello,

I work for the Department of Health and Senior Services, and I am taking the AI Supervised Learning sequence with Richard Ng. I am enjoying the lessons. I am taking this sequence because I am interested in applying techniques of Supervised Learning to challenges to population health. If you are curious about this, you are welcome to contact me.

My particular questions here deal with initial installation of Python and its utilities. I am trying to use Python for my first set of projects and I do not know how to install these items:

1. utils

The error message is as follows …

from utils import \*  
Traceback (most recent call last):  
File “”, line 1, in  
ModuleNotFoundError: No module named ‘utils’

```auto
 2. >>>matplotlib

```

The error …

%matplotlib inline  
File “”, line 1  
%matplotlib inline  
^  
SyntaxError: invalid syntax

1. utils.py

I realize that there are files related to the assignments–should I try to copy and paste the code from these files directly into my Python 3.12 window or should I download it and add code to the code given to us for my window to access it???

Your assistance would be greatly appreciated.

All the best,

John

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [November 5, 2026, 4:01pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/2 "2026-11-05T16:01:34Z")

</div>

Are you trying to set up your own local environment?

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 5, 2026, 4:49pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/3 "2026-11-05T16:49:18Z")

</div>

Hello TMosh,

Thanks for the quick response. I do not believe so; I am working on a state government network that is connected to the WWW.

I am working to tap the shoulder of a colleague who has a lot of experience working with Python to help me out.

I will try to run some of the code in the assignments for the first course within the sequence and I will report if I have any issues.

Many thanks!!

John

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [November 5, 2026, 6:37pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/4 "2026-11-05T18:37:41Z")

</div>

Hi, John.

If you simply run the assignments on the course website, then all the software packages are already provided for you in that environment. But if you want to take the code from the course notebooks and run it on your own computer, then that’s an entirely different matter. Your best bet is to install one of the popular programming environment apps (so-called "IDE"s for Integrated Development Environment) and run things in that context locally. PyCharm is one example that is particularly oriented around python, but there are many others. If you just search “IDEs for python” you’ll find websites that offer advice. But my guess is that your colleague who is already experienced with python will also have some specific guidance on this question that will be optimized for your local network environment.

Regards,  
Paul

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [November 5, 2026, 6:48pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/5 "2026-11-05T18:48:27Z")

</div>

Setting up your own local environment can be rather complicated and confusing.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [November 5, 2026, 8:18pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/6 "2026-11-05T20:18:33Z")

</div>

Indeed. There are no “official” instructions because there are just too many possibilities. Are you using Windows or MacOS or linux? Which version of any of those and on and on …

Running locally is beyond the scope of the courses here, but [here’s a thread](https://community.deeplearning.ai/t/dls-1-my-own-project-in-pycharm/74781/4) that talks about setting up PyCharm just to give you a sense of the scale of what is involved. If you decide that’s the way you need to go, you can use that to get started down that long and winding road. 🤓

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 9, 2026, 7:34pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/7 "2026-11-09T19:34:42Z")

</div>

> [@paulinpaloalto](#):
>
> e no “official” instructions because there are just too many possibilities. Are you using Windows or MacOS or linux? Which version of any of those and on and on …
> 
> Running locally is beyond the scope of the courses here, but [here’s a thread](https://community.deeplearning.ai/t/dls-1-my-own-project-in-pycharm/74781/4) that talks about setting up PyCharm just to give you a sense of the scale of what is involved. If you decide that’s the w

**At 12 noon today, 11/9. I am working on the Logistic Regression lab (C1\_W3\_Logistic\_Regression) for the Supervised Learning course and I cannot get the sigmoid function to work properly.**

I am using a Jupyter file to execute the code.

When I use this code, it reports the incorrect result.

value = 0

print (f"sigmoid({value}) = {sigmoid(value)}")

```auto
sigmoid(0) = None

```

The value should be 0.5.

Your help would be greatly appreciated.

Best regards,

John

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 9, 2026, 7:36pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/8 "2026-11-09T19:36:18Z")

</div>

> [@John\_Fieno](#):
>
> **At 12 noon today, 11/9. I am working on the Logistic Regression lab (C1\_W3\_Logistic\_Regression) for the Supervised Learning course and I cannot get the sigmoid function to work properly.**
> 
> I am using a Jupyter file to execute the code.
> 
> When I use this code, it reports the incorrect result.
> 
> value = 0
> 
> print (f"sigmoid({value}) = {sigmoid(value)}")
> 
> ```python
> sigmoid(0) = None
> 
> ```
> 
> The value should be 0.5.
> 
> Your help would be greatly appreciated.
> 
> Best regards,
> 
> John

**At 12 noon today, 11/9. I am working on the Logistic Regression lab (C1\_W3\_Logistic\_Regression) for the Supervised Learning course and I cannot get the sigmoid function to work properly.**

I am using a Jupyter file to execute the code.

When I use this code, it reports the incorrect result.

value = 0

print (f"sigmoid({value}) = {sigmoid(value)}")

```python
sigmoid(0) = None

```

The value should be 0.5.

Your help would be greatly appreciated.

Best regards,

John

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [November 9, 2026, 7:38pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/9 "2026-11-09T19:38:36Z")

</div>

It looks like the return value of the `sigmoid` function must be the python token `None`. Are you sure that you implemented the internal code for that function? Meaning the body of the `sigmoid` function?

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 9, 2026, 7:54pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/10 "2026-11-09T19:54:34Z")

</div>

Yes, I believe that I did–

```auto
# UNQ_C1

# GRADED FUNCTION: sigmoid

def sigmoid(z):
"""
Compute the sigmoid of z

Args:
    z (scalar or ndarray): A scalar or numpy array of any size.

Returns:
    g (scalar or ndarray): sigmoid(z), with the same shape as z if z is a numpy array.
     
"""
      
### START CODE HERE ### 

### END SOLUTION ###  

return g

```

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [November 9, 2026, 8:01pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/11 "2026-11-09T20:01:21Z")

</div>

Unlisted on November 9, 2026, 8:01pm UTC



---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [November 9, 2026, 8:01pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/12 "2026-11-09T20:01:41Z")

</div>

I have unlisted the thread so it can discuss the specific code solution.

I edited the post to wrap it in “code” tags correctly.

Notes:

- The 'return" statement needs to be indented.
- There is no code that computes the ‘g’ value.

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 13, 2026, 7:42pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/13 "2026-11-13T19:42:28Z")

</div>

I am still having with the code for the C1\_W2\_Linear\_Regression assignment. This is the code that I am trying to run…

# UNQ\_C1

# GRADED FUNCTION: compute\_cost

def compute\_cost(x, y, w, b):

```auto
m = x.shape[0] 

# You need to return this variable correctly
total_cost = 0

### START CODE HERE ###
# Compute cost with some initial values for paramaters w, b

```

h = 0  
for i in range(m):

# Public tests

from public\_tests import \*  
compute\_cost\_test(compute\_cost)

```auto
### END CODE HERE ### 

```

return total\_cost

# Compute cost with some initial values for paramaters w, b

initial\_w = 2  
initial\_b = 1

cost = compute\_cost(x\_train, y\_train, initial\_w, initial\_b)  
print(type(cost))  
print(f’Cost at initial w: {cost:.3f}')

#### 

The answer should be **Cost at initial w: 75.203** , but nothing is produced.  
Some help would be appreciated. Many thanks!!!

Best regards,  
John

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 13, 2026, 7:44pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/14 "2026-11-13T19:44:36Z")

</div>

I am still having with the code for the C1\_W2\_Linear\_Regression assignment. This is the code that I am trying to run…

# UNQ\_C1

# GRADED FUNCTION: compute\_cost

def compute\_cost(x, y, w, b):

```ini
m = x.shape[0] 

# You need to return this variable correctly
total_cost = 0

### START CODE HERE ###
# Compute cost with some initial values for paramaters w, b

```

h = 0  
for i in range(m):

# Public tests

from public\_tests import \*  
compute\_cost\_test(compute\_cost)

### END CODE HERE

````auto

return total_cost

# Compute cost with some initial values for paramaters w, b

initial_w = 2
initial_b = 1

cost = compute_cost(x_train, y_train, initial_w, initial_b)
print(type(cost))
print(f’Cost at initial w: {cost:.3f}')

#### 

The answer should be **Cost at initial w: 75.203** , but nothing is produced.
Some help would be appreciated. Many thanks!!!

Best regards,
John
[/quote]

I am still having with the code for the C1_W2_Linear_Regression assignment. This is the code that I am trying to run…

# **UNQ_C1**

# **GRADED FUNCTION: compute_cost**

def compute_cost(x, y, w, b):

```ini
m = x.shape[0] 

# You need to return this variable correctly
total_cost = 0

### START CODE HERE ###
# Compute cost with some initial values for paramaters w, b

````

h = 0  
for i in range(m):

# **Public tests**

from public\_tests import \*  
compute\_cost\_test(compute\_cost)

```graphql
### END CODE HERE ### 

```

return total\_cost

# **Compute cost with some initial values for paramaters w, b**

initial\_w = 2  
initial\_b = 1

cost = compute\_cost(x\_train, y\_train, initial\_w, initial\_b)  
print(type(cost))  
print(f’Cost at initial w: {cost:.3f}')

#### 

The answer should be **Cost at initial w: 75.203** , but nothing is produced.  
Some help would be appreciated. Many thanks!!!

Best regards,  
John

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [November 13, 2026, 7:45pm UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/15 "2026-11-13T19:45:07Z")

</div>

You have to modify the compute\_cost() function in the notebook, so that it computes the cost. The equation you need to implement is given in the notebook.

The notebook also includes several “hint” links, which give you the exact code to add.

You should not use compute\_cost\_test(), because that also calls your compute\_cost() function.

All of the “\_test” functions are used for testing your code, to see if it gives the expected results.

---

<div class="post-metadata">

**Author:** ![John\_Fieno](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Fieno](https://community.deeplearning.ai/u/John_Fieno)\
**Post date:** [November 17, 2026, 12:37am UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/16 "2026-11-17T00:37:02Z")

</div>

I finished the first assignment and I tried to submit the second one on logistic regression. When I submitted it, I continue to get the same error:

Cell #8. Can’t compile the student’s code. Error: NameError(“name ‘g’ is not defined”)..

Here is my code …

# UNQ\_C1

# GRADED FUNCTION: sigmoid

def sigmoid(z):  
“”"  
Compute the sigmoid of z

```
Args:
    z (scalar or ndarray): A scalar or numpy array of any size.

Returns:
    g (scalar or ndarray): sigmoid(z), with the same shape as z if z is a numpy array.
     
"""      
### START CODE HERE ### 

### END SOLUTION ###  
g= (1 / (1 + np.exp(-z)))    
return g

```

I ran all the code again and all my answers seem correct. What is causing the issue?

Many thanks for all your help!!!

All the best,  
John

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [November 17, 2026, 2:22am UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/17 "2026-11-17T02:22:34Z")

</div>

For starters, try moving your code so that it is entirely between the START and END markers.

Also:

- In general, please try to not share your code. Techncially that’s not allowed on the forums. Only on this specific thread have we set the “hidden” attribute.

- A screen capture image is a better choice than a text copy-and-paste - because the indentation levels can be obscured. Python is very picky about indentation.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [November 17, 2026, 2:36am UTC](https://community.deeplearning.ai/t/introduction-and-general-issues-with-python/896178/18 "2026-11-17T02:36:31Z")

</div>

In addition to the points that Tom listed, it’s also worth checking to make sure you have done a “Save” and that the save was successful before you do the “Submit” to the grader. One way to check that the “Save” was actually successful would be to reopen the assignment after the save. Then check to make sure that your latest changes are still there in the notebook.
