w3resource

Python: Listify the list of given strings individually using map function

Python map: Exercise-3 with Solution

Write a Python program to listify the list of given strings individually using Python map.

Sample Solution:

Python Code :

color = ['Red', 'Blue', 'Black', 'White', 'Pink'] 
print("Original list: ")
print(color) 
print("\nAfter listify the list of strings are:") 
result = list(map(list, color)) 
print(result)

Sample Output:

Original list: 
['Red', 'Blue', 'Black', 'White', 'Pink']

After listify the list of strings are:
[['R', 'e', 'd'], ['B', 'l', 'u', 'e'], ['B', 'l', 'a', 'c', 'k'], ['W', 'h', 'i', 't', 'e'], ['P', 'i', 'n', 'k']]

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to add three given lists using Python map and lambda.
Next: Write a Python program to create a list containing the power of said number in bases raised to the corresponding number in the index using Python map.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz



Python: Tips of the Day

Big Number Readability:

you can separate zeros with underscore (_)

print(2_000_000)
print(2_000_000 +1)

Output:

2000000
2000001