Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- items = ["Cheese", "Tomato", "Potato", "Cucumber", "Salt", "Pepper"]
- def beautifulList(array):
- string = ""
- for index, item in enumerate(array, start=1):
- string += "and " + item if index == len(items) else item + ", "
- return string
- print(beautifulList(items))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement