Complete the code to declare a variable named greeting with the value "Hello".
var greeting: String = [1]In Swift, strings are enclosed in double quotes. So, "Hello" is the correct way to assign the string value.
Complete the code to create a Character constant named letter with the value 'A'.
let letter: Character = [1]Characters in Swift are also enclosed in double quotes, just like strings, but assigned to a Character type.
Fix the error in the code to concatenate two strings greeting and name with a space in between.
let fullGreeting = greeting [1] " " [2] name
In Swift, the plus sign (+) is used to join (concatenate) strings.
Fill both blanks to create a dictionary that maps each word to its length if the length is greater than 3.
let wordLengths = Dictionary(uniqueKeysWithValues: words.filter { word in word.[1] > 3 }.map { word in (word, word.[2]) })In Swift, to get the length of a string, use the count property. So word.count gives the length.
Fill all three blanks to create a dictionary that maps uppercase words to their lengths if length is greater than 4.
let result = Dictionary(uniqueKeysWithValues: words.filter { word in word.[3] > 4 }.map { word in (word.[1](), word.[2]) })Use word.uppercased() to convert to uppercase, and word.count to get length. The condition checks if length is greater than 4.