python

Python Operators

An operator is used to perform some sort of operation on variables and values. For example- a = 4 b = 7 c = a + b print(c) Output 11 Python has the following type of operators     Arithmetic operators Assignment operators Comparison operators Logical Operators Membership Operators Identity …

Python Operators 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 »

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 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 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 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? Consider a situation- What if I ask you to print “Hello World” 4 times in Python. …

Python Loops Read More »