Python: Map over list
11 September 2022 (Updated 11 September 2022)
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
capitalized_fruits = [fruit.upper() for fruit in fruits]
print(capitalized_fruits)
# ['APPLE', 'BANANA', 'CHERRY', 'KIWI', 'MANGO']
Tagged:
Python
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment