Swift - Operators and Expressions
Given a dictionary of student scores, use a ternary operator in Swift to create a new dictionary that marks each student as "Pass" if their score is 50 or more, otherwise "Fail".
What is the correct way to write this using dictionary comprehension?
What is the correct way to write this using dictionary comprehension?
let scores = ["Anna": 75, "Ben": 45, "Cara": 50]
let results = scores.mapValues { score in
// Fill in here
}