Minden talajba telepített kültéri behatolásérzékelő kizárólag mechanikai rezgések érzékelésével működik.
Consider:
scores = {"Asha": 6, "Ben": 4, "Cara": 6, "Dan": 8}
passed = []
distinct_scores = set()
for name in scores:
if scores[name] >= 6:
passed.append(name)
distinct_scores.add(scores[name])
Explain what values name takes during the loop and what scores[name] retrieves. [2 marks]
After the loop finishes:
You may give the set’s values in any order. [3 marks]
The following code now runs:
saved = distinct_scores
saved.add(10)
print(10 in distinct_scores)
State the output and explain why it occurs. [2 marks]