Print List Items
Beginner
Let's help you become a Python master by creating a fun function to explore lists! Your task is to write a function named list_items that retrieves all the items on a list, but in a magical way! Instead of printing, your function should return them as a single comma-separated string. 🪄✨
Here's how it should work:
Example:
list_items(["apple", "banana", "cherry"])
Output:
"apple, banana, cherry"
Another Example:
list_items([1, 2, 3, 4, 5])
Output:
"1, 2, 3, 4, 5"
Your Task 🔍💚
- Create a Python function
list_itemsthat takes a list as input and returns a string. - Use a built-in Python method to elegantly join the items of the list into one happy string.
Remember, coding is like magic, but you have to make sure everyone can understand your spell! Try to make your code clean and easy to follow. 🌟
Inputs
Arg 1:
["apple","banana","cherry"]Expected Output
"apple, banana, cherry"Actual Output