Category Archives: Python – Basics

Python basics category includes basic topics of python which includes following articles.

Getting started with python and installing python, Installing windows IDE PyCharm, Comments and indentation in python, Identifiers and keywords in python.

Python check length and size of string.

In this python article, We are going to learn python built-in functions len() and getsizeof(). len(): Using len() function we can check the length of an object(count number of items). In short len() function returns us the number of elements present in the sequence (List, Tuple, String, range) or in a mapping (Dictionary or set). getsizeof(): Using getsizeof() function we can check how much memory in bytes is allocated to store a complete object. Introduction to len() function: Basically len() function queries the container and returns

Read More

Python package

In this article we are going to learn about what is python package. How to create a package in python. How to import a module from package also rename while importing. What is significance of file “__init__.py” in package and how package initialization works. What is Package in Python: Python package is a directory with modules in it. Basically when our python code gets bigger then it becomes very difficult to maintain it and the only preventive solution is to keep the code well organized. Write

Read More

Python Modules

In this article we are going to learn about python modules. How to a write a python module. Different ways of importing a python module into a program. Most commonly used built-in python modules and how search path works. What is python module? Python module is a python file containing python definitions and executable statements. Biggest advantage of python module is we can use any python program readily into our program without actual copying the code definitions. When a program gets bigger then it becomes very

Read More

Python File Handling I/O – Reading and Writing files in python

In this article we are going to learn about file handling in python. How to open a file using python, Different python methods to Read and write a content in a file. Close the file once we are done with the editing. Also we are going to see other methods available in python read/write mode. File handling in python: So before getting started with the topic file handling in python. Let’s first try to understand what is a file? Term “file” is very basic concept for

Read More

Python Anonymous/Lambda function

In this series of python tutorial we are going to learn next python function i.e python lambda function. What are the syntax of python lambda or anonymous function. Where and How to use python anonymous/lambda function. What is Lambda or Anonymous function in python? The python function which is defined without name is knows as Lambda or Anonymous function. Lambda function is not declared in standard manner like other python function types. Like, While defining a normal python function we use def keyword. Whereas for defining a

Read More

Python recursive function

What is recursive function in python? Recursion is a way of programming in which a function calls itself for one or more times. A Python function which is defined to call itself during its execution is known as python recursive function. This way of programming enables the function to be executed several times. Recursive function body also contains a base condition to prevent the function getting into an infinite loop. So that was the definition of python recursive function, Now let’s proceed to understand each term in

Read More

function arguments in python

Introduction to function arguments in python: In python, Inputs given to the function are known as function arguments or parameters. Depending upon how we have defined the function, There are four basic types of arguments and in this article we are going to learn each the argument type in detail. If you don’t know the terms python function, argument, return statement etc. then I would request you to please go through the earlier article Python Functions. Python user defined function: To start with this article, Let’s

Read More

Functions in python

Introduction to python functions: In this article, We are going to learn what is python function? Different types of python functions. How to write and call python function in a program. So let’s get started with the definition of python function. What is python function? Function in python is a collection of related statements which are used to perform a specific task and return the result or value to the caller of the function. It basically breaks our code into smaller and modular chunks of code and

Read More

Python pass statement

Introduction to python pass statement: From last few articles we are learning about looping statements in python. Until now we have covered basic looping statements i.e for loop and while loop. Also we have covered topic break and continue statements in python using which we can decide whether to exit or continue the loop execution. Now let’s proceed further in this series and learn more about pass statement in python. Python pass statement is used as a placeholder in a program. Pass statement in python is a null statement i.e Nothing

Read More

Python break and continue statements

Introduction to python break and continue statements: In last few articles we have learned about looping in python and we have covered topics python for loop and python while loop. Basically these looping statements in python allows us to repeat the same task or code block efficiently. Using looping statements we can repeat the execution of code until the specified condition is satisfied. However sometimes we may come across some situations wherein: We want to terminate the loop execution and exit the loop without checking the

Read More