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 trialHaitham Alam
2,685 Pointscheck
check if this is the right answer? I am getting error network all the time?
var results: [Int] = []
for n in 1...100 {
if n % 2 != 0 && n % 7 == 1{
results.append(n)}
// End code
}
2 Answers
Tobias Helmrich
31,603 PointsHey there,
you almost got it right! The only problem you have is that you're comparing the remainder of n divided by 7 to 1. However if n is a multiple of 7, the remainder will be 0. So if you compare it to 0 instead of 1 it should work just fine!
Like so:
var results: [Int] = []
for n in 1...100 {
if n % 2 != 0 && n % 7 == 0 {
results.append(n)
}
}
I hope that helps! :)
Haitham Alam
2,685 Pointsyou are great