All problems
Contamination Overlap Rate
Problem
Return the fraction of eval items whose exact string appears in the training item list. Return 0.0 when the eval list is empty.
Test cases
case 1
in: [["a","b","c"],["b","c","d"]]
expected: 0.6666666666666666
case 2
in: [["x"],[]]
expected: 0
case 3
in: [[],["a"]]
expected: 0
case 4
in: [["a","a"],["a"]]
expected: 1
Starter codePython
def contamination_rate(eval_items, train_items):
# Your code here
pass4 test cases · run your code against them in the editor