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 break Statement

The break statement in Python is used to get out of the current loop. We can’t use break statement outside the loop, it will throw an error as “SyntaxError: ‘break’ outside loop“. We can use break statement with for loop…

Python if else elif Statement

Python if-elif-else statement is used to write a conditional flow code. The statements are in the order of if…elif…else. The ‘elif’ is short for ‘else if’ statement. It’s shortened to reduce excessive indentation. The else and elif statements are optional.…

Python Data Types

Python is an object-oriented programming language. Every variable in Python is an instance of some class. There are many pre-defined Python data types. We can create our own classes to define custom data types in Python. What are the Popular…

Python Docstring

Python Docstring (Document String) is a string literal that is the first statement in a module, function, class, or method. How to Write a Python Docstring? Python docstring is surrounded by a pair of triple double-quotes (“””). Let’s look at…

Python Variables

Variables in Python are an identifier to reference a value in the program. A variable contains the memory location of the object. They allow python programs to access other objects and call their functions or perform other operations. Rules to…

Python Keywords

Python keywords are reserved words. They are used by python interpreters to understand the program. Keywords define the structure of programs. We can’t use keywords to name program entities such as variables, classes, and functions. How Many Keywords in Python?…