|
|
back to boardWhat is wrong? current_key = int(input().strip()) backup_key = int(input().strip()) for thief_key in range(0, 9999): if current_key == thief_key: print("yes") break if thief_key > current_key or thief_key > backup_key: print("no") break temp_key = backup_key backup_key = current_key current_key = temp_key It passes tests with "0001/0000" -> no and "0002/0001" -> yes. And I traced it, it works right. But they said, that I have wrong answers. Why? P.S. Mistake of course was in the line: if thief_key > current_key or thief_key > backup_key: I should use and instead or. Edited by author 24.09.2013 01:56 |
|
|