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 Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join