Length Is 2 or More and The First and Last Character Are Same From A Given List of Strings
Length Is 2 or More and The First and Last Character Are Same From A Given List of Strings
5. Write a Python program to count the number of strings where the string
length is 2 or more and the first and last character are same from a given list
of strings.
Sample List : ['abc', 'xyz', 'aba', '1221']
Expected Result : 2
6. Write a Python program to get a list, sorted in increasing order by the last
element in each tuple from a given list of non-empty tuples.
Sample List : [(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)]
Expected Result : [(2, 1), (1, 2), (2, 3), (4, 4), (2, 5)]
9. Write a Python program to find the list of words that are longer than n from
a given list of words.
10. Write a Python function that takes two lists and returns True if they have at
least one common member.
12. Write a Python program to print a specified list after removing the 0th, 4th
and 5th elements.
Sample List : ['Red', 'Green', 'White', 'Black', 'Pink', 'Yellow']
Expected Output : ['Green', 'White', 'Black']
13. Write a Python program to generate and print a list of first and last 5
elements where the values are square of numbers between 1 and 30 (both
included).
14. Write a Python program to get the difference between the two lists.
.
17. Write a Python program to add unique values into a list L2 from a list L1
Original list:
[1, 2, 4, 6, 8, 10, 12, 14, 16, 17]
False
25. Write a Python program to check if the elements of a given list are unique
or not.
Original list:
[1, 2, 4, 6, 8, 2, 1, 4, 10, 12, 14, 12, 16, 17]
False
Original list:
[2, 4, 6, 8, 10, 12, 14]
True
10+11+8=29
30. Write a Python program to sort a given mixed list of integers and strings.
Numbers must be sorted before strings.
Original list:
[19, 'red', 12, 'green', 'blue', 10, 'white', 'green', 1]
Sort the said mixed list of integers and strings:
[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']
32. Write a Python program to add two given lists of different lengths, start
from left.
Original lists:
[2, 4, 7, 0, 5, 8]
[3, 3, -1, 7]
Add said two lists from left:
[5, 7, 6, 7, 5, 8]
33. WAP to input two matrices from the user and find the addition of the
matrices.
34. WAP to input two matrices from the user and find the multiplication of the
matrices.
35. WAP to input a matrix from the user and find the Transpose of the matrix.