ErrorMessage says: class myitr, " myitr " is NOT defined

The problem has nothing to do with NumPy, and there is no good reason to expect it to have anything to do with NumPy, and there is nothing in the code you have shown that uses NumPy or would benefit from NumPy.

It does not make sense to try to find out about whether NumPy includes something called myitr, because the point of your own code is to define that. When you write class myitr:, that’s what it means.

The problem is caused because of indentation. Because of how you indented the code, the loop for i in myitr(5): is inside the class. This makes no sense. Python needs to understand what a class myitr: is first, before it can run such a loop. Therefore, that loop cannot be part of the definition.

You get NameError because, when Python figures out what class myitr: contains, it tries to run the for i in myitr(5): loop, which means it has to look up myitr to find out that it is a class. But myitr is not yet a class, because Python did not finish creating it yet.

This loop doesn’t do anything necessary for defining the class; it only uses the class. Therefore, it should be outside of the class, which means it should not be indented into the class body.

In the previous thread, you had the same problem with indentation (actually, the wrongly indented code was indented even further). Then there were several problems in a row that were all the same: using the wrong name, because of wrong capitalization.

You were also told more than once in that thread (I don’t know what happened to @hansgeunsmeyer 's post) to post the code properly as text, so that we can discuss it properly. You agreed to do so, but then made this thread and are still posting the code as images - so you’ve been told about it in this thread again. Please read the pinned thread and make sure you understand how this works.

My advice to you is that if you are getting stuck on issues like this, you should not be trying to follow this e-book. Instead, you should be practicing with a general tutorial for the fundamentals of Python. The official documentation includes one and there is more advice on the Python web site. Please keep in mind that learning to program - in Python or any other language - is a process of making mistakes and learning from them. It is about paying attention and trying to solve problems yourself using what you have already learned (instead of asking others about every issue that comes up).