为什么这不起作用?
def straight(ranks):
"Return True if the ordered ranks form a 5-card straight."
return range(max(ranks)-4, max(ranks)+1) == ranks.sort()
假设等级为:
>>> ranks = [9, 8, 7, 6, 5]
>>> range(max(ranks)-4, max(ranks)+1)
[5, 6, 7, 8, 9]
>>> ranks.sort()
[5, 6, 7, 8, 9]
那为什么是:
>>> range(max(s)-4,max(s)+1) == s.sort()
False