From b4e9c3f25e0bd9af8d6e874e06265f77167a333a Mon Sep 17 00:00:00 2001 From: MlleDolce Date: Wed, 4 Apr 2018 20:46:58 -0400 Subject: [PATCH] Completed Array Challenge Lab. All tests pass. --- ArrayChallenge/ShoppingList.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArrayChallenge/ShoppingList.swift b/ArrayChallenge/ShoppingList.swift index 646e1db..cdc7f02 100644 --- a/ArrayChallenge/ShoppingList.swift +++ b/ArrayChallenge/ShoppingList.swift @@ -12,11 +12,11 @@ class ShoppingList { func createShoppingList(withItems items: [String], amountOfEachItem amounts: [String]) -> [String] { - - // Implement this function - - - + var reconstructedList: [String] = [] + for (index, item) in items.enumerated() { + reconstructedList.append("\(index + 1). \(item)(\(amounts[index]))") + } + return reconstructedList } }