Crus4

logo

Identity Operators in Python (with Examples)

Identity Operators in Python In Python, Identity operators are used to compare two variables and check if they refer to same object. If doesn’t matter if the variables hold different or equal values, what matters is if they are actually the same object, with the same memory location. There are two Identity operators ‘is‘ and […]

What are Relational Operators in Python

What are Relational Operators in Python Relational Operators in Python are used to compare two values using Comparison Operators and return a result in Boolean values, either ‘True’ or ‘False’. As the name suggests, Relational Operators are used to determine the relationship between two operands. There are mainly six commonly used Relational Operators in Python. […]

What are Classes and Objects in Python

What are Classes and Objects in Python In Python, Classes and Objects are fundamental concepts in object oriented programming (OOP). With the help of Classes and Objects we can model real-world entities and their behaviors in the code. Here is what classes and objects are: Python Classes A Class is a blueprint or template for […]

Python Functions (A Beginner’s Guide)

Python Functions (A Beginner’s Guide) Python Functions are a block of code that is designed to repeatedly perform a specific task. We can write a group of statements inside a function which only execute when we call. We can call a function as many times we want, this makes our code shorter and easy to […]

Python Loops: for and while

Python Loops: for and while In Python, there are mainly two types of Loops, for loop and while loop. Both these loops are mainly used to execute a set of statements more than one time. For example, if we want to print “Happy Coding” for 100 times then we have to write the print statement […]

Python if else Statement

Python if else Statement Python if else statement are used to make decisions, about which block of code is to execute next. The if Statement The if statement runs a block of code when a certain condition is True or when a certain condition met. Example Since 3 is greater than 2, the if statement […]

What are Tokens in Python

What are Tokens in Python Python Tokens are the smallest meaningful units in a program. In python, all the statements and instructions in a program are constructed using tokens. The various python tokens includes:- Keywords Keywords are reserved words that have special meaning in python. In the latest version of python, there are about 35 […]

Sets Union in Python

Sets Union in Python In Python, if we have two Sets, set A and set B, the Union of Set combines all the unique elements from both the Sets into a new set. We use the union() method or the | operator to perform union of two Sets. Here is an example: Example Example Explained […]

Python Dictionaries (Full Explained)

Python Dictionaries (Full Explained) In Python, Dictionaries allows us to store data in key: value pairs. Dictionary is one of the 4 built-in data types in python, the other 3 are Lists, Tuples and Sets. Dictionaries are mutable and ordered collection of key-value pairs. They can also contain elements of different Data type. Here is […]

Python Sets

Python Sets In Python, a Set is an unordered collection of unique elements, that means duplicate elements are not allowed in a Set. Set is one of the 4 built-in data types in Python, the other 3 are List, Tuple and Dictionary. Sets in Python are created by placing all the elements inside curly braces […]