Quiz · Dictionaries and sets · lesson 4 of 6
Quiz — a dictionary
Question 1 of 2
What does the program print?
let words = ["to", "be", "or", "not", "to", "be"]
var counts: [String: Int] = [:]
for word in words {
counts[word, default: 0] += 1
}
print(counts["be", default: 0], counts.count)