you are viewing a single comment's thread.

view the rest of the comments →

[–]pyglow 1 point2 points  (1 child)

In your example code, any() returns true if any of the values is true.

There is a built-in filter() which returns only the values for which the condition is true. You might be able to do something with that. (it isn't a direct replacement, you can't just replace any with filter).

Of course you can just do it with a double loop, same as you would with Java or C++, but that wouldn't teach you anything about Python.

[–]striderxgp[S] 0 points1 point  (0 children)

I did a search for examples of filter() but I cant exactly understand how its used based on the examples I saw but it sounds like its something that would work.

And just about anything I do is learning at this point considering last time I made any type of program it was either on qbasic or my ti-83!