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 trialdk13
10,541 PointsWhat do you do when your code executes perfectly on the online Swift playground but does not pass "Recheck Work" ?
The following code works on the online Swift playground, but does not pass the test when I "Recheck work". I added the print(results) statement to verify that it works...
var results: [Int] = []
for n in 1...100 { // Enter your code below // n % 2 returning a zero indicates an even number, so have to use NOT operator let even = n % 2 let sevensMultiple = n % 7 if !(even == 0) && (sevensMultiple == 0) { // add number to the array results += [n] print(results) } }
var results: [Int] = []
for n in 1...100 {
// Enter your code below
// n % 2 returning a zero indicates an even number, so have to use NOT operator
let even = n % 2
let sevensMultiple = n % 7
if !(even == 0) && (sevensMultiple == 0) {
// add number to the array
results += [n]
}
}
2 Answers
KRIS NIKOLAISEN
54,971 PointsIn reviewing students previous posts it looks like the checker wants you to use the results.append() method. Good job though.
dk13
10,541 PointsThank you!