Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNikhil Pandey
1,418 PointsError in the quiz answer
The 2nd quiz question for "Modifying Arrays" asks for removing the 3rd entry in my code I am putting atIndex value equal to 2 (since arrays start from 0) but inbuilt answer is rejecting 2 instead accepting 1 as true value which is wrong since question asks for removing the 3rd entry while the answer is implying removing 2nd value. Kindly look into this
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
todo.removeAtIndex(2)
let item = todo.removeAtIndex(2)
2 Answers
Chris Shaw
26,676 PointsHi Nikhil,
The reason the challenge isn't accepting your answer is because you're removing the third item in the array which is "Deploy App" then removing "Debug App", the challenge asks for you to remove the third item and assign it as a value to a new constant called item
which you're doing but after removing it. Simply removing the first removeAtIndex
declaration will solve the problem and the challenge will pass.
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
let item = todo.removeAtIndex(2)
Happy coding!
Nikhil Pandey
1,418 PointsHi I just did this and realise my mistake but 3rd quiz question which is "Learn iOS" and assigning it 2nd position in the todo that still is not resolving as it shows the bummer your todo has wrong value