Arnab Chakraborty has Published 4293 Articles

Python program to find score and name of winner of minion game

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:39:25

463 Views

Suppose there are two players Amal and Bimal. They are playing a game. The game rules are as follows −Both players have a same string s.Both of them have to make substrings using the letters of s.Bimal has to make words starting with consonants.Amal has to make words starting with ... Read More

Program to update list items by their absolute values in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:33:50

245 Views

Suppose we have a list of numbers called nums with positive and negative numbers. We have to update this list so that the final list will only hold the absolute value of each element.So, if the input is like nums = [5, -7, -6, 4, 6, -9, 3, -6, -2], ... Read More

Python program to find better divisor of a number

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:33:33

448 Views

Suppose we have a number n. We have to find divisor of n which one is better based on these conditions: We have two numbers p and q, the one whose digits sum to a larger number is called better than the other one. When the sum of digits is ... Read More

Program to find length of a list without using built-in length() function in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:31:13

760 Views

Suppose we have a list nums. We have to find the length of this list but without using any length(), size() or len() type of functions.So, if the input is like nums = [5, 7, 6, 4, 6, 9, 3, 6, 2], then the output will be 9.To solve this, ... Read More

Program to reverse a list by list slicing in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:21:58

252 Views

Suppose we have a list of n elements called nums. We have to reverse this list by list slicing operations.So, if the input is like nums = [5, 7, 6, 4, 6, 9, 3, 6, 2], then the output will be [2, 6, 3, 9, 6, 4, 6, 7, 5]To ... Read More

Program to create a list with n elements from 1 to n in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:14:45

3K+ Views

Suppose we have a number n. We have to create a list of elements of size n, the elements are from 1 to n.So, if the input is like n = 5, then the output will be [1, 2, 3, 4, 5]To solve this, we will follow these steps −use ... Read More

Python program to get average heights of distinct entries

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:09:11

682 Views

Suppose we have a set of heights there may be some duplicate entries as well. We have to find the average of distinct entries of these heights.So, if the input is like heights = [96, 25, 83, 96, 33, 83, 24, 25], then the output will be 52.2 because the ... Read More

Program to find only even indexed elements from list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:09:01

2K+ Views

Suppose we have a list of elements called nums. We have to filter out all odd indexed elements, so only return even indexed elements from that list.So, if the input is like nums = [5, 7, 6, 4, 6, 9, 3, 6, 2], then the output will be [7, 4, ... Read More

Python program to convert complex number to polar coordinate values

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:07:03

426 Views

Suppose we have a complex number c, we have to convert it into polar coordinate (radius, angle). Complex number will be in form x + yj. The radius is the magnitude of the complex number which is square root of (x^2 + y^2). And the angle is the counter clockwise ... Read More

Python program to get all permutations of size r of a string

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 07:04:29

476 Views

Suppose we have a string s and a number r. We have to display all permutations of r number of characters in s. We have permutations() function to get all permutations. This function is present inside itertools library.So, if the input is like s = "HELLO" r = 3, then ... Read More

Advertisements