tutorial

Python File Handling

File handling means interacting with files that are stored on your computer. These interactions could be reading and writing data to those files. Moreover, file handling is a crucial part of any web application. In this tutorial, we will cover file handling in Python. In Python , open() function is […]

Python File Handling Read More »

Python Arrays

Python does not have built-in support for arrays like other programming languages like C, C++ etc. But it has many data types like lists that can be used as arrays. Except for one thing, in a typical array, all elements should be of the same type, but in lists, this

Python Arrays Read More »

Python Lambda Functions

A lambda function in Python is an anonymous function that can take any number of arguments but can return only one expression. A lambda function is defined by using the ‘lambda’ keyword. Syntax lambda arguments: expression In the syntax: arguments are any value passed expression is the returned value Example:

Python Lambda Functions Read More »

Python Functions

A function is a block of code that can be written once and used as many times as one wants. Once defined, a function can be used by calling it wherever and whenever required. What is the need for functions? Imagine you need to write a chunk of code to get

Python Functions Read More »

Python Loops

According to Google – “In computer programming, a loop is a sequence of instructions that is continuously repeated until a certain condition is reached.” Now try to understand this. Why Loops are so important? Imagine this: You are asked to print “Hello World” 4 times in Python. You might write:

Python Loops Read More »

Python Dictionaries

In Python, a dictionary is a collection type that is used to store data in the form of key-value pairs. A dictionary is ordered, changeable, and does not allow duplicate values. The factor that makes a dictionary different from lists, tuples or sets is that in a dictionary each value

Python Dictionaries Read More »

Python sets

Just like the lists or tuples, a set in python is also one of the collection types. A set is unordered, unindexed, and unchangeable. It is written using curly braces. Example of a set: cities = {'Delhi', 'Mumbai', 'Hyderabad', 'Bhopal'} print(cities) Output: {‘Delhi’, ‘Mumbai’, ‘Hyderabad’, ‘Bhopal’} Set items are unordered

Python sets Read More »

Python tuples

Like lists, tuples are also used to store multiple values in a single variable. It is a collection that is ordered and unchangeable. Unlike lists, Tuples are written with round brackets. Example sample_tuple = ("east", "west", "north", "south") print(sample_tuple) Output: (“east”, “west”, “north”, “south”) Tuples are ordered Tuples are ordered,

Python tuples Read More »

Python lists

A list in Python is a datatype that is used to store multiple values. A list can be formed by assigning different values inside square brackets and separated by commas. Example mylist = ["India", "France", "Australia", "Nepal"] print(mylist) Output: [“India”, “France”, “Australia”, “Nepal”] Items in list are ordered, indexed, and

Python lists Read More »