I've been making a poker simulator and I've managed to make a function which can identify an array which has consecutive numbers.
def straightCheck(playerHand):
playerHand.sort()
print(playerHand)
for i in range(len(playerHand)-1):
if playerHand[i] != playerHand [i+1] - 1:
return False
print(handstrength)
return True
print(handstrength)
The only problem is that I want the function to identify 5 consecutive numbers in the array when the length of the array is greater than 5. For example: I want the array [1,2,3,4,5,6,7] to return True but i also want the array [1,3,4,5,6,7,9] to return True.