Last active
March 31, 2024 19:35
-
-
Save TheMuellenator/812634fa99b17ff62cb747ba869dae29 to your computer and use it in GitHub Desktop.
iOS repl.it - Arrays Challenge Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = [45, 73, 195, 53] | |
//Create a new array called computedNumbers | |
var computedNumbers = [ | |
numbers[0] * numbers[1], | |
numbers[1] * numbers[2], | |
numbers[2] * numbers[3], | |
numbers[3] * numbers[0] | |
] | |
print(computedNumbers) |
var lst = [1,2,3,4,5]
var lst2 = Int
for i in 0...lst.count-2{
let x = lst[i] * lst[i+1]
lst2.append(x)
}
let y = lst[lst.count-1] * lst[0]
lst2.append(y)
print(lst2)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
func exercise() {
}