Python QB-1
Python QB-1
6. Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an
empty string. Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
7. Python code to get the Cumulative sum of a list
8. Python code to count the number of occurrences of an item in a list.
9. Write a Python program to check a list is empty or not.
10. Python program to check if a string has at least one letter and one number.
11. Python program to capitalize the first and last character of each word in a string
13. Write a Python program to add two given lists using map and lambda.
14. Write a Python program that multiply each number of given list with a given number using lambda function. Print the result.
**
***
****
*****
18. Write a Python program to input a 5 × 5 matrix and print the 2nd row, and 3rd element in 4th row.
19. Two strings are anagrams if you can make one from the other by rearranging the letters.Write a function named is_anagram
that takes two strings as its parameters. Your function should return True if the strings are anagrams, and False otherwise.
22. Python program to implement variable function argument and thereby find out area of a rectangle.
23. Write a Python program to find numbers divisible by nineteen or thirteen from a list of numbers using Lambda.
25. Python code to display the words in a phrase that have the greatest and lowest ASCII values of characters.
27. Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given
n scores. Store them in a list and find the score of the runner-up.
i/p: n=6
236654
o/p= 5
28. Input the string (Honorificabilit) and check for the minimum frequent vowel and maximum frequent
consonant.
29. Find out the 3rd highest element from an input list.
30. write a function that accepts a number as a parameter. The function should return a number that’s the difference between the
largest and smallest numbers that the digits can form in the number.
For example, if the parameter is “213”, the function should return “198”, which is the result of 123 subtracted from 321.