Add an if to filter:
scores = {"alice": 85, "bob": 60, "carol": 92}
passing = {name: score for name, score in scores.items() if score >= 70}
# {"alice": 85, "carol": 92}
Only key-value pairs where the condition is true get included.
This is cleaner than building the dictionary with a loop and if statement.