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 trialSumit Chawla
20,056 PointsBug in Challenge Task 2 of 4: Keep getting the error "Oops, looks like Task 1 is no longer passing."
I started with the following code: var arrayOfInts:[Int] = [4, 5, 6, 34, 2, 1] This passed task 1. Then I added the following: arrayOfInts.append(444) arrayOfInts += [7, 8]
Now I keep getting the error "Oops, looks like Task 1 is no longer passing.". I have verified the code in Playground and it works fine, not sure why this error occurs. Is this a bug in the challenge?
var arrayOfInts:[Int] = [4, 5, 6, 34, 2, 1]
arrayOfInts.append(444)
arrayOfInts += [7, 8]
1 Answer
andren
28,558 PointsThe error message is pretty misleading but there is an error in your code, or more accurately your code does not do exactly what the challenge asked you to do.
The challenge asks you to add one item using the append method and then one item using the concatenation technique. You add two items using the concatenation technique, not one. That is what is causing the code checker to complain. The code checker is often pretty picky about having your code do precisely what it asks and not anything more. And this is one of those moments.
If you only add one item like this:
var arrayOfInts: [Int] = [4, 5, 6, 34, 2, 1]
arrayOfInts.append(444)
arrayOfInts += [7]
Then your code will pass the task.
Edit: I see you have already figured out the problem. That's good. But you should keep what I mention above about the code checker being picky in mind for future challenges. This is far from the only task where doing more than what is asked will lead your code to be marked as wrong even if it is actually fine.
Sumit Chawla
20,056 PointsSumit Chawla
20,056 PointsTrue, agreed.