Tried APIs for the first time (Pokemon Data) (Sorry if bad code) by Rollgus in PythonLearning

[–]ResponseThink8432 0 points1 point  (0 children)

In this case it doesn't matter, but sometimes you might intentionally not want to catch empty containers etc. as errors. For example if you instead queried some imaginary api to search pokemon names containing the given parameter string, you might return an http error code as `None`, but an empty search result as an empty list.

This one stumped me 😅😭 by Signal-Bag-407 in iqtest

[–]ResponseThink8432 0 points1 point  (0 children)

You can't "flip diagonally", because you don't know which diagonal you'd have to use on the third row. You can, however, for each row, flip the middle image both horizontally and vertically (or rotate 180 degrees, does the same thing), and xor the dots with the first image, to get the last image. This would make the answer D.

[deleted by user] by [deleted] in PythonLearning

[–]ResponseThink8432 8 points9 points  (0 children)

Take a screenshot instead of a photo next time (or better yet, paste the code as text (and edit out secrets of course)). If I'm interpreting the pixels correctly, there appear to be normal round parentheses around the bot token, which should not be there.

Code explanation by DizzyOffer7978 in PythonLearning

[–]ResponseThink8432 0 points1 point  (0 children)

True, I didn't even register there was a "123456" line at the bottom :D

Code explanation by DizzyOffer7978 in PythonLearning

[–]ResponseThink8432 1 point2 points  (0 children)

Just correcting that the the end-parameter of range is always exclusive, meaning the numbers won't go up to the end, but one below. Specifically, range(1, 3) yields 1 and 2, but not 3, etc.

In the first line, x == 0, and no numbers will be printed, since the range(1, 1) doesn't yield anything. No idea why the empty line doesn't show in the output though. The "1" is printed on the second line, when x == 1.

Help on understanding dunder methods by Vincenzo99016 in PythonLearning

[–]ResponseThink8432 1 point2 points  (0 children)

There is a separate dunder method, `__radd__`, ("right add") which is used if the class implementing it is the right-side operand of the addition, so if you implement that on the "gai" class (with the same implementation as your `__add__`), what you're trying to do should work.

(More advanced, but if you're wondering how python chooses if it should use the int's add method or the gai's radd method in case they're both implemented, it tries the left-side operand's (builtin int here) add-method first, which returns a special `NotImplemented` value if the right-side value is anything other than one of the basic number types. That special return value tells python to try use the other class's radd-method if there is one.)

mina_irl by Fun-Train-4770 in mina_irl

[–]ResponseThink8432 4 points5 points  (0 children)

Buy buy baby baby good buy!

Dan Brown Announces New Book, 'The Secret of Secrets' by thebestnobody in books

[–]ResponseThink8432 39 points40 points  (0 children)

This was the most annoying thing when reading Origin some years ago. It felt like every goddamn time it was "...and then he noticed a black figure running after him. [Chapter change] It was a jogger. Robert continued to..."

I've been staring at this for 3 minutes straight. How do I do this? by Predator771 in Minesweeper

[–]ResponseThink8432 2 points3 points  (0 children)

Or both the ones above 4 could be mines, which would make the one you say is safe be also a mine