Write Python3 code to demonstrate Remove Rear K characters from String List using map() + lambda


Topic: Write Python3 code to demonstrate Remove Rear K characters from String List using map() + lambda

Solution

test_list = ['Manjeets', 'Akashs', 'Akshats', 'Nikhils'] 
print("The original list : " + str(test_list)) 
K = 4
res = list(map(lambda i: i[ : (len(i) - K)], test_list)) 
print("The list after removing last characters : " + str(res)) 



List all Python Programs