I'm trying to make this programm and I want from a list that it randomly get generated to find the 2,3,4,...,K,A and if there are more than a number n to return that number. Same for the 3rd def but there I want the C,D,H,S and then return how many they are. But all I'm getting as a result from the 2nd def is none. What do I have to fix to make it work?
Here is the code if it helps anyone
import random
def make_deck():
suits=['C', 'D', 'H', 'S']
ranks=['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
deck = [s+r for s in suits for r in ranks]
random.shuffle(deck)
return deck
def same_rank(hand, n):
if hand.count('2')>n:
count2=hand.count(2)
return count2
else:
return 'None'
if hand.count(3)>n:
count3=hand.count(3)
return count3
else:
return 'None'
if hand.count(4)>n:
count4=hand.count(4)
return count4
else:
None
if hand.count(5)>n:
count5=hand.count(5)
return count5
else:
return 'None'
if hand.count(6)>n:
count6=hand.count(6)
return count6
else:
return 'None'
if hand.count(7)>n:
count7=hand.count(7)
return count7
else:
return 'None'
if hand.count(8)>n:
count8=hand.count(8)
return count8
else:
return 'None'
if hand.count(9)>n:
count9=hand.count(9)
return count9
else:
return 'None'
if hand.count(10)>n:
count10=hand.count(10)
return count10
else:
return 'None'
if hand.count('J')>n:
countJ=hand.count('J')
return countJ
else:
return 'None'
if hand.count('J')>n:
countQ=hand.count('Q')
return countQ
else:
return 'None'
if hand.count('K')>n:
countK=hand.count('K')
return countK
else:
return 'None'
if hand.count('A')>n:
countA=hand.count('A')
return countA
else:
return 'None'
def same_suit(hand):
if hand.count('C')>0:
countC=hand.count('C')
if hand.count('D')>0:
countD=hand.count('D')
if hand.count('H')>0:
countH=hand.count('H')
if hand.count('S')>0:
countS=hand.count('S')
return countC, countD, countH, countS
hand = make_deck()[:10]
print hand
n=raw_input('Give n')
print same_rank(hand,n)