Arnab Chakraborty has Published 4452 Articles

Python program to find hash from a given tuple

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 10:26:56

4K+ Views

Suppose we have a tuple. There are few numbers are present. We have to find the hash value of this tuple by using hash() function. This is a built-in function. The hash() function can work on some datatypes like int, float, string, tuples etc, but some types like lists are ... Read More

Python program to sort and reverse a given list

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 10:22:32

641 Views

Suppose we have a list of numbers in Python. We have to reverse and sort the lists using list operations but do not change the actual list. To reverse the list we have reverse() function for lists but if we use it, the list will be reversed in place. Similar ... Read More

Python program to find average score of each students from dictionary of scores

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 10:20:43

6K+ Views

Suppose we have a dictionary of students marks. The keys are names and the marks are list of numbers. We have to find the average of each students.So, if the input is like scores = {'Amal' : [25, 36, 47, 45], 'Bimal' : [85, 74, 69, 47], 'Tarun' : [65, ... Read More

Program to find expected sum of subarrays of a given array by performing some operations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:30:51

235 Views

Program to find expected sum of subarrays of a given array by performing some operationsSuppose we have an array A whose size is n and two values p and q. We can perform these operations on A.Randomly select two indexes (l, r) where l < r, then exchange A[l] and ... Read More

Python program to display all second lowest grade student name from nested list

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:28:02

1K+ Views

Suppose we have the names and grades for each student in a nested list we have to display the names of any students having the second lowest grade. If there are more than one students with the second lowest grade, reorder these in an alphabetical order and print each name ... Read More

Python program to find runner-up score

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:21:47

1K+ Views

Suppose we have a list of scores for different number of participants. We have to find the runner-up score.So, if the input is like scores = [5, 8, 2, 6, 8, 5, 8, 7], then the output will be 7 because the winner score is 8 and second largest score ... Read More

Program to find expected value of maximum occurred frequency values of expression results in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:20:44

93 Views

Suppose we have M different expressions, and the answers of these expressions are in range 1 to N (both inclusive) So consider x = max(f(i)) for each i in range 1 through N, we have to find the expected value of x.So, if the input is like M = 3, ... Read More

Program to find out the palindromic borders in a string in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:18:52

214 Views

Suppose we are provided with a string str. A border of a string is a substring that is a proper prefix and a suffix of that string. For example, 'ab' is a border of the string 'ababab'. A border is called a palindrome border if the border string is a ... Read More

Program to find out the substrings of given strings at given positions in a set of all possible substrings in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:08:44

114 Views

Suppose we are provided n number of strings; str1, str2, str3, ....., strn. Now, let's suppose that substri is a set that contains all the substrings of stri. The union of all the substr sets is substr_union. We now are given q number of queries, and we have to find ... Read More

Program to count number of isosceles triangle from colored vertex regular polygon in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 09:05:19

175 Views

Suppose we have one regular polygon with n sides represented as a binary string of size n. The vertices can be colored either in blue (0) or in red (1). They are colored in clockwise direction We have to count number of isosceles triangles whose vertices are vertices of the ... Read More

Advertisements