What output will be produced by the code below?
import Foundation let number = 16.0 print("\(number) squared is \(number * number), and its square root is \(sqrt(number))")
Correct answer: "16.0 squared is 256.0, and its square root is 4.0".
Explanation: Using its type inference, Swift will consider
number to be an
Double, which will be interpolated correctly into the string even when
sqrt() is called. When
Doubles are interpolated into strings, they have .0 appended to their values when they have no fractional digits.