Given an integer X, find its square root. If X is not a perfect square, then return floor(√x). Examples : Input: x = 4Output: 2Explanation:… Read More
Category Archives: Python Programs
In this article, we will learn how to print the pattern G using stars and white-spaces. Given a number n, we will write a program… Read More
Given the Cost Price(CP) and Selling Price(SP) of a product. The task is to Calculate the Profit or Loss.Examples: Input: CP = 1500, SP =… Read More
Given a string, convert the characters of the string into the opposite case,i.e. if a character is the lower case then convert it into upper case… Read More
Given numeric string str, the task is to remove all the leading zeros from a given string. If the string contains only zeros, then print… Read More
Given a set, the task is to write a Python program to delete the last element from the set. Example: Input: {1,2,3,4}Remove 4Output: {1,2,3} Input:… Read More
Given a string, the task is to write a Python program to remove the last character from the given string. Example: Input: “GeeksForGeeks”Output: “GeeksForGeek” Input:… Read More
In this article, we will learn what are the different ways to add values in a dictionary in Python. Method 1: Assign values using unique… Read More
Given an integer basic and a character grade which denotes the basic salary and grade of a person respectively, the task is to find the… Read More
Given and denoting that the Cost Price of N articles is equal to the Selling Price of M articles. The task is to determine the profit or… Read More
Given a list, the task is to write a Python program to remove the last element present in the list and update the original list… Read More
Given a set of elements p, the task is to write a Python program to convert the whole set into a list of Python Sets.… Read More
Given lists in a list, the task is to write a Python program to find the maximum product of elements of list in a Python… Read More
Given a python list, the task is to write a Python program to convert the list into a dictionary with indexes as keys. Example: Input… Read More
Given a tuple, the task is to write a Python program to delete the last element in the tuple in Python. Example: Input: (“geeks”, “for”,… Read More