Python Reverse A String

In this article, we will discuss reversing a string in Python. We will look into different approaches. 1. Naive method In this naive approach, we will loop through each letter in the string and joins them to form a reverse string as shown below. Output 2. Reverse using list.reverse() In this approach, we will convert … Read more

Switch Case in Python

A switch case is a flow control statement used in programming languages. In this article, we will discuss the switch case in Python. The syntax of switch statements in programming languages like C++, C, Java, etc. How does it work? The switch expression is evaluated once The value of each case is evaluated, if there … Read more

Python Range Function

Python offers different inbuilt functions, one such function is range. In this tutorial, we will learn about range functions in Python with examples. The range function Rather than being a function, the range type is an immutable sequence of numbers. Ranges implement all of the common sequence operations except concatenation and repetition. Syntax of the … Read more

What is While Loop in Python

Python offers different flow control statements. The While loop is one of the flow control statements used in Python. In this tutorial, we will learn about while loops in Python with examples. The while loop The while loop is used for the repeated execution of code as long as the condition is true. Syntax of … Read more

Reverse List in Python

Sometimes we need to reverse the list in Python. In this tutorial, we will learn how to reverse a list in Python. 1. Using the list reverse method The list.reverse() method will reverse the elements of the list in place. Syntax of the list reverse method : Arguments: Reverse method does not take any parameters. … Read more

Python List Remove Duplicates

We may need to work with lists in Python, sometimes we need to remove duplicates from the list. In this article, we will discuss different list duplicate removal methods. Naive method First, we will look simple naive method to remove list duplicates. The basic logic is : Define a result list. Loop the input list. … Read more

10 Easter Eggs in Python

Easter eggs python

Have you heard about Python Easter eggs? In this article, we will discuss the 10 best Easter eggs in Python. 1.Simple Hello World This Easter egg will print a hello world message. Open the python terminal and try this code. Hello world can be printed using importing __phello__. 2. The Zen of Python As per … Read more