iOS Swift Collections and Control Flow Control Flow With Conditional Statements Working With Logical Operators

Nayef Mandi
PRO
Nayef Mandi
Pro Student 2,020 Points

I can't solve the challenge 1 .. its very hard

hi, i need help with challenge 1 ..

what i understand with if statmenet and logical operators

var result < 7 { print(" ????") }

they ask to use not operator ( ! ) i gave up with this challange

operators.swift
var results: [Int] = []

for n in 1...100 {
if results < 7 { 
print("

}

close the print ")

1 Answer

Maria Te
Maria Te
8,476 Points

It asks to check if n is an odd and can be divisible by 7. If so, you should append n to the results variable. Your code isn't right about anything. Your code should look like this:

var results: [Int] = []

for n in 1...100 {
    // Enter your code below
    if n%2 != 0 && n%7 == 0 {
    results.append(n)
    }
    // End code 
}

Hope that this has been some help to you!

Maria Te
Maria Te
8,476 Points

If this has been any help to you, please mark as a Best Answer? I would really appreciate it if you did!