Python list comprehension along with examples

In this article, We are going to learn how list comprehension works along with its examples. So basically Python List comprehension is a simple and elegant way of creating a list in python. It returns us a new list after performing specified operation on each element of iterable (List or sequence). List comprehension requires a input list and operation statement. During the execution of program it takes each element of input list and will perform specified operation on that element. Output after performing operation will be

Read More

Python Dictionary data type

In this python article, We are going to learn next python Dictionary data type. What is dictionary data type, How to create it. How to add/edit/delete and access dictionary element. Different methods associated with python dictionary data type. So let’s get started with the python dictionary data type tutorial. What is python dictionary data type: Dictionary data type in Python is an unordered collection of data values. In simple words it is a collection of key:value pairs. Each key is mapped to its associated value. So the

Read More

Python Directory management

In this article, We are going to learn about files and directory management in python. Different methods available in python os path module. We are going to cover topics like, How to create a folder using python, How to rename a directory using python, Listing all directories and working with them. What is directory/folder management in python: Basically Directory or folder is a container for holding the files and sub-directories. In context of python directory/folder and file management we are going to perform following operations on

Read More

Sets in python

Introduction to sets in python: In this tutorial we are going to learn python Set data type. So let’s first start with the definition of python set data type. It is an unordered collection of unique (non duplicates) immutable elements or items. Here an individual data item of set is called as an element or an item of set. set_variable = {1,2,3} In above example numbers 1, 2, 3 are known as the elements or items of set. How to create a Set in python? There

Read More

Tuple data type in python

Introduction to Tuple Data Type in python: In this article we are going learn python Tuple data type in detail. Topics which we are going to cover are, What is tuple data type, How to create tuple? How to use it and what are the methods available with tuple date type. Also the basic difference between python list and tuple. Out of many available python data types, Tuple, String and List data type have one common characteristic. All of these three data types belongs to Sequence

Read More

List data type in python

Introduction to python List data type: List data type is the most widely used data type in python. So first of all let’s understand, What is meant by List in python? List is the data type format in python, Which is used to store data in list format i.e in an ordered sequence of elements. Members of list are called as list items or elements. This list is mutable(changeable) i.e You can edit the list over the course of time. So let’s begin to learn the

Read More

Number data type and Type Conversion in python

What is Number data type and type conversion in python? To start with the python number data type and type conversion, Let’s first see Number data type. Python number data type is the data type which is used to store the numeric data. You can perform arithmetic operations on this data type. When you assign a new value to numeric data type a new object gets created. This is immutable data type, Hence as soon as you try to change its value, new object gets created.

Read More

String slicing and indexing in python

What is slicing and indexing in python? To understand string slicing and indexing let’s first understand what is the definition of string? So basically the String is a sequence of characters which consists of letters, numbers, symbols and white spaces. Now since strings is a sequence. In python we have a provision, using which we can access and work with each and every part of string sequence. In technical words this accessing and working with the strings is known as string indexing and string slicing. String Indexing

Read More

String concatenation and replication in python

Introduction to strings in python: String is a sequence of characters which includes letters, numbers and symbols like punctuation marks etc. In simple words string is the data in text format. Strings data type also contains white spaces in it. Text data is one of the mostly used data type in our day to day life. Let’s see one example of strings, In python “Apple” is a string and sentence “I ate an apple” is also a string, not only that but “123789” is also a

Read More

Variables and Data types in python

Variables in Python: Variables are the reserved memory locations to store the data. Which means for each variable in your program, separate memory location is reserved. As soon as you assign some value to the variable in you program, python interpreter utilizes the reserved memory space of that variable. But how much memory to be reserved and what type of data you can store in a variable depends upon data type of variable. To understand variables in detail let’s first try to understand what is meant

Read More