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.
Python continue Statement

Python continue Statement

A while loop may need to skip one value and still check its condition again for the next iteration. The Python continue statement skips the rest of the current iteration and moves to the next one. I’ll show how to…

Python break Statement

Python break Statement

When a loop has reached the point where it should stop, you need a way to end it before it checks more items or repeats again. Python’s break statement ends the for or while loop that contains it. I’ll show…

Python Hello World Program

Python Hello World Program

Starting with Python often means checking whether a short program can display a message. A Python Hello World program uses print() to display the text Hello World. This article gives you the code and shows how to run it from…

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…