all = 10 lost = [3,8] have = [2,9] answer = all - len(lost) for i in range(len(lost)): if lost[i]+1 == have[i] or lost[i]-1 == have[i]: answer += 1 print(answer)
To embed this project on your website, copy the following code and paste it into your website's HTML: