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 Tuple – An Immutable Sequence

Python tuple is an immutable sequence. The tuple is created with values separated by a comma. Since a tuple is immutable, we can’t add or delete its elements. If the tuple elements are not immutable, their properties can be changed.…

Python lambda – Anonymous Function

Python lambda function or Python anonymous function has no name. We can define an anonymous function using the lambda reserved keyword. The anonymous function scope is limited to the current scope where it’s defined. A lambda function can have one…

Python continue Statement

Python continue statement is used to skip the execution of the current iteration of the loop. We can’t use continue statement outside the loop, it will throw an error as “SyntaxError: ‘continue’ outside loop“. We can use continue statement with for…

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 while Loop

Python while loop is used to repeat a block of code until the specified condition is False. The while loop is used when we don’t know the number of times the code block has to execute. We should take proper…

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.…