2016-10-15 83 views
-1
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

为什么不'返回总> 0' –

+0

我要投票因为它属于代码审查,因此将其作为题外话题来关闭。 – pacholik

回答

6

使用您只需通过更换if语句:

return total > 0 
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 
相关问题