Python - Basic Articles
map() function returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable (list,… Read More
Python String zfill() method returns a copy of the string with ‘0’ characters padded to the left side of the given string. Syntax of zfill()… Read More
Python String split() method splits a string into a list of strings after breaking the given string by the specified separator. Example: Python3 string =… Read More
min() is an inbuilt function in Python programming language that returns the minimum alphabetical character in a string. Syntax: min(string) Parameter: min() method takes a… Read More
max() is an inbuilt function in Python programming language that returns the highest alphabetical character in a string. Syntax: max(string) Parameter: max() method takes a… Read More
Python String count() function returns the number of occurrences of a substring within a String. Python3 #initializing a string my_string = "Apple" #using string count()… Read More
Majority Element: A majority element in an array A[] of size n is an element that appears more than n/2 times (and hence there is… Read More
Python String find() method returns the lowest index or first occurrence of the substring if it is found in a given string. Example Python3 #… Read More
If we want to extract or define something from the rest of the image, eg. detecting an object from a background, we can break the… Read More
Python String swapcase() method converts all uppercase characters to lowercase and vice versa of the given string and returns it. Syntax:  string_name.swapcase()   Parameter:  The… Read More
Python String isalnum() method checks whether all the characters in a given string are either alphabet or numeric (alphanumeric) characters. Python String isalnum() Method Syntax:… Read More
Given a string, find all the duplicate characters which are similar to each other. Let us look at the example.  Examples: Input : helloOutput :… Read More
Python String endswith() method returns True if a string ends with the given suffix, otherwise returns False. Python String endswith() Method Syntax Syntax: str.endswith(suffix, start,… Read More
Iterating over single lists, refers to using for loops for iteration over a single element of a single list at a particular step whereas in… Read More
Python String center() method creates and returns a new string that is padded with the specified character. Syntax:  string.center(length[, fillchar]) Parameters: length: length of the… Read More
Given a non-negative number n and two values l and r. The problem is to count the number of set bits in the range l… Read More
Given a positive number n, count total bit in it.  Examples:   Input : 13 Output : 4 Binary representation of 13 is 1101 Input :… Read More
The problem statement asks to produce a new list whose i^{th} element will be equal to the sum of the (i + 1) elements. Examples :  … Read More
Given two lists, find the missing and additional values in both the lists. Examples: Input : list1 = [1, 2, 3, 4, 5, 6] list2… Read More
The sort function can be used to sort the list in both ascending and descending order. It can be used to sort lists of integers,… Read More