def in_puzzle_horizontal(puzzle, word):
left_right = lr_occurrences(puzzle, word)
right_left = lr_occurrences((rotate_puzzle(rotate_puzzle(puzzle))), word)
total = left_right or right_left
if total > 0:
return True
else:
return False
答案 0 :(得分:6)
您只需将if语句替换为:
return total > 0
答案 1 :(得分:1)
left_right = lr_occurrences(puzzle, word)
right_left = lr_occurrences((rotate_puzzle(rotate_puzzle(puzzle))), word)
total = left_right or right_left
return total > 0