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 trialJørgen Norsted
iOS Development with Swift Techdegree Student 1,752 PointsStuck in challenge 1 of 1 in Swift Collections and Control Flow
I do not know what to do here. I think some of the problem is that English is not my first language. I do not know what "a multiple by 7" means. But can anyone point me in the right direction. Where should I start?
var results: [Int] = []
for n in 1...100 {
// Enter your code below
// End code
}
3 Answers
Brandon Mahoney
iOS Development with Swift Techdegree Graduate 30,149 PointsSo a multiple is a number that when divided by a given number will not have a remainder. For example 14 is a multiple of 7 because 14 divided by 7 is 0. You use the % sign find the remainder of two numbers.
Below n % 2 will find if it is odd or even and n % 7 will find if it is a multiple of 7.
var results: [Int] = []
for n in 1...100 {
// Enter your code below
if n % 2 != 0 && n % 7 == 0 {
results.append(n)
}
// End code
}
Sarah Hurtgen
Treehouse Project ReviewerHi! I believe the task would be wanting you to multiply (times) a range of numbers by 7. For example, if the multiplier was 2, it would read: 2 * 7
Hopefully that helps point you in the right direction. If you need further help with this specific challenge, it would be great if you posted a direct link to it for us to be able to see the exact requirements.
Best luck! :)
Jørgen Norsted
iOS Development with Swift Techdegree Student 1,752 PointsThank you both! There may be some problem with the language sometimes, but it helps to get it explained :)