title-img


Athlete Sort python

You are given a spreadsheet that contains a list of N athletes and their details (such as age, height, weight and so on). You are required to sort the data based on the Kth attribute and print the final resulting table. Follow the example given below for better understanding. image Note that K is indexed from 0 to M-1, where M is the number of attributes. Note: If two attributes are the same for different rows, for example, if two atheletes are of the same age, print the row that appear

View Solution →

Any or All python

any() This expression returns True if any element of the iterable is true. If the iterable is empty, it will return False. Code >>> any([1>0,1==0,1<0]) True >>> any([1<0,2<1,3<2]) False all() This expression returns True if all of the elements of the iterable are true. If the iterable is empty, it will return True. Code >>> all(['a'<'b','b'<'c']) True >>> all(['a'<'b','c'<'b']) False Task You are given a space separated list of integers. If all the integers are posi

View Solution →

ginortS python

You are given a string S. S contains alphanumeric characters only. Your task is to sort the string S in the following manner: All sorted lowercase letters are ahead of uppercase letters. All sorted uppercase letters are ahead of digits. All sorted odd digits are ahead of sorted even digits. Input Format A single line of input contains the string S. Constraints 0<len(S)<1000 Output Format Output the sorted string S.

View Solution →

Map and Lambda Function python

Let's learn some new Python concepts! You have to generate a list of the first N fibonacci numbers, 0 being the first number. Then, apply the map function and a lambda expression to cube each fibonacci number and print the list. Concept The map() function applies a function to every member of an iterable and returns the result. It takes two parameters: first, the function that is to be applied and secondly, the iterables. Let's say you are given a list of names, and you have to print a li

View Solution →

Validating Email Adresses With a Filter python

You are given an integer N followed by N email addresses. Your task is to print a list containing only valid email addresses in lexicographical order. Valid email addresses must follow these rules: It must have the username@websitename.extension format type. The username can only contain letters, digits, dashes and underscores. The website name can only have letters and digits. The maximum length of the extension is 3. Concept A filter takes a function returning True or False

View Solution →