I don't get it, I'm trying to count the 2 in this list and when it is like this:
hand=['D2', 'H5', 'S2', 'SK', 'CJ', 'H7', 'CQ', 'H9', 'D10', 'CK']
f=''.join(hand)
count2=f.count('2')
print count2
it works perfectly and it prints me 2 as the number of times the 2 is in the list. But when I'm putting it in an if it doesn't work:
def same_rank(hand, n):
if hand.count('2')>n:
print hand.count('2')
else:
print 'bite me'
hand=['D2', 'H5', 'S2', 'SK', 'CJ', 'H7', 'CQ', 'H9', 'D10', 'CK']
f=''.join(hand)
n=raw_input('Give n ')
print same_rank(hand,n)
If the user gives the n=1 then it is supposed to print 2 because the number 2 is twice in the list and I want it to be more than one that it is! So why it doesn't return that?