ython code. Instructions are given within the quotations for each function. 1) def fun_a(cards): """ cards is a list of int numbers ranging between 0 to 12 inclusive. We use the number to represent the card's rank in a deck of card. 0 is '2', 1 is '3', ...,9 is 'J', 10 is 'Q', 11 is 'K' and 12 is 'A' This function is to check if there is full house in the cards. If
python code. Instructions are given within the quotations for each function.
1) def fun_a(cards):
"""
cards is a list of int numbers ranging between 0 to 12 inclusive. We use the number to represent the card's rank in a deck of card. 0 is '2', 1 is '3', ...,9 is 'J', 10 is 'Q', 11 is 'K' and 12 is 'A' This function is to check if there is full house in the cards. If we can find five cards of the form x,x,x,y,y where three have the same rank x and two have the same rank y. If there are more than one options, choose the highest rank x that has three cards of the same rank; then choose the highest rank y in the remaining cards that has two cards of the same rank. return (x, y) if such a hand exists. otherwise return None.
"""
return
2) def run():
""" Implement the run function so that it repeatedly ask the user to enter an int between 0 to 12 inclusive to form a deck of cards to be used by fun_a(). The input ends when user enters an int outside of the range 0 to 12. Then it calls fun_a() with the list formed and print out the answer. """
return
if __name__ == "__main__": run()
Step by step
Solved in 3 steps with 2 images