When i m creating class in Python , i am getting error

class Ghosh:
Husband = ‘Bubun’
Wife = ‘Lopa’
Daughter =‘Aishee’
theGhosh = Ghosh()
print(theGhosh.Daughter)

NameError: name ‘Ghosh’ is not defined

I need help to sort the issue…i am coding in Jupyter notebook

This is not pertinent to this forum. Unless there’s something your formatting is hiding (or more accurately, lack-there-of, see below), you’d most likely have the same issue if you were running this as a Python script from the command line with that code as the content or if you pasted that into an IPython interpreter console. Hence, that makes it not a Jupyter issue.

When you find the appropriate location for your post…
For posting on forums such as this you’ll want to learn how to use code blocks to keep the formatting of the lines. Without the indentation, it is hard for anyone to help you. See here, with special attention to ‘Block code formatting’. That skill will help you in many places. In StackOverflow, they have an icon you can select.

3 Likes