Pankaj Kumar

Pankaj Kumar

I have been working on Python programming for more than 12 years. At AskPython, I share my learning on Python with other fellow developers.
How to Get a Substring in Python

How to Get a Substring in Python

`”banana”.find(“pear”)` returns `-1` when the text is absent. I’m fascinated that a failed search has a clear result, while `-1` can still act as a valid slice position. You can separate the idea of a text fragment from the operation…

Python np.argmax() function

Python np.argmax() function

With `axis=0` on a 2×3 array, the result has one row index for each column. I like how that lets each column identify its own winning position. Those indices can guide a separate lookup for each column’s winner. `np.argmax` returns…

Python Operators

Python Operators

The `+` in `8 + 3` adds, while the same symbol in `”py” + “thon”` joins text. I like that one familiar symbol can do both jobs, depending on what it acts on. Once you can name the operation, choosing…