2016-10-15 127 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 
相關問題