Python - Basic Articles
Given a string and a number N, we need to mirror the characters from the N-th position up to the length of the string in… Read More
In both real life and programming, decision-making is crucial. We often face situations where we need to make choices, and based on those choices, we… Read More
Given a string S, remove all the consecutive duplicates. Examples: Input : aaaaabbbbbb Output : ab Input : geeksforgeeks Output : geksforgeks Input : aabccba… Read More
Given an n x n matrix and integer k. Find the k’th smallest element in the given 2D array. Examples: Input : mat = [[10,… Read More
Prerequisite : Python-Dictionary 1. What will be the output? dictionary = {"geek":10, "for":45, "geeks": 90} print("geek" in dictionary) Options: 10 False True Error Output: 3.… Read More
Given an IP address, remove leading zeros from the IP address. Examples:   Input : 100.020.003.400 Output : 100.20.3.400 Input :001.200.001.004 Output : 1.200.1.4 Recommended Practice… Read More
Python String title() method returns a new string after converting the first letter of every word to uppercase(capital) and keeping the rest of the letters… Read More
Given a boolean 2D array, where each row is sorted. Find the row with the maximum number of 1s.  Examples: Input: matrix = [[0, 1,… Read More
Given a list, print the number of numbers in the given range.   Examples:  Input : [10, 20, 30, 40, 50, 40, 40, 60, 70] range:… Read More
Extend and Append are two Python list methods used to add elements to a list. Although they appear similar, they have different functionalities and use… Read More
In this article, we will see how we can sort a tuple (consisting of float elements) using its float elements. Here we will see how… Read More
In this article, we will see how we can remove elements at a given index and print the list afterward. Example Input1: list = [10,… Read More
Given a list, print all the values in a list that are greater than the given value   Examples: Input : list = [10, 20, 30,… Read More
Sometimes you might need to convert a tuple to dict object to make it more readable. In this article, we will try to learn how… Read More
Given two arrays, find their intersection. Examples: Input: arr1[] = [1, 3, 4, 5, 7] arr2[] = [2, 3, 5, 6] Output: Intersection : [3,… Read More
Given two lists a, b. Check if two lists have at least one element common in them.  Examples: Input : a = [1, 2, 3,… Read More
In this program, we need to count the number of vowels present in a string and display those vowels. This can be done using various… Read More
In this program, we will try to convert a given string to a list, where spaces or any other special characters, according to the user’s… Read More
In Python programming, comparing two lists is a common task with multiple approaches. This article explores different methods for obtaining the dissimilarity between two lists,… Read More
In this article, we will go through various ways of copy lists in Python. These various ways of copying list take different execution times, so… Read More