‘builtin_function_or_method’ object is not iterable
stuff ends up a method of function so you would need to call it: Which based on your comment is the dict.items. So you can unpack: Or just call when you assign:
stuff ends up a method of function so you would need to call it: Which based on your comment is the dict.items. So you can unpack: Or just call when you assign:
The problem is that you have a circular import: in app.py in mod_login.py This is not permitted in Python. See Circular import dependency in Python for more info. In short, the solution are either gather everything in one big file delay one of the import using local import
My question looks like this: I am supposed to solve the equation. My answer seems to come out as 8 when using PEMDAS: But when putting it into python, I get a 2. Why is this so? It seems the programs order is as such: I don’t get it.
It’s cultural. In Python, you don’t write to other classes’ instance or class variables. In Java, nothing prevents you from doing the same if you really want to – after all, you can always edit the source of the class itself to achieve the same effect. Python drops that pretence of security and encourages programmers to be … Read more
here is the error I get: I have read several posts about a.any() or a.all() but still can’t find a way that really clearly explain how to fix the problem. I see why Python does not like what I wrote but I am not sure how to fix it.
numpy.vectorize takes a function f:a->b and turns it into g:a[]->b[]. This works fine when a and b are scalars, but I can’t think of a reason why it wouldn’t work with b as an ndarray or list, i.e. f:a->b[] and g:a[]->b[][] For example: This yields: Ok, so that gives the right values, but the wrong dtype. And even worse: yields: So this … Read more
It seems from your error than the ‘index’ variable is a string, not an int. You could convert it using int(). Now, string[index:] will also be an string. So you would need to convert that too: That’s assuming that string[index:] only contains a number. If that’s not always the case, you can do something like: … Read more
Change to You are getting the input from the console as a string, so you must cast that input string to an int object in order to do numerical operations.
You haven’t called pygame.init() anywhere. See the basic Intro tutorial, or the specific Import and Initialize tutorial, which explains: Before you can do much with pygame, you will need to initialize it. The most common way to do this is just make one call. This will attempt to initialize all the pygame modules for you. Not all pygame modules need … Read more
Stacking requires same number of dimensions. One way would be to unsqueeze and stack. For example: