Question: import math import random import string import collections import datetime import re import time import copy # YOUR CODE BELOW... def checkRegex(str2) : your code

import math

import random

import string

import collections

import datetime

import re

import time

import copy

# YOUR CODE BELOW...

def checkRegex(str2) :

your code here...

# end def

def fancyList(table, cityFrom, cityTo) :

your code here...

# end def

def natureSequence(fn, sn, n) :

your code here...

# end def

def printEvens(a, b) :

your code here...

# end def

def generatePokerHand(deck, coords) :

your code here...

# end def

def main( ) :

rv = checkRegex("abcdefghijklmnopqrstuvwxyz")

print(rv)

rv = checkRegex("Mariner!")

print(rv)

rv = checkRegex("acdefGhij*012345")

print(rv)

fancyList( )

rv = natureSequence(0, 1, 10)

rv = natureSequence(1, 3, 15)

printEvens(433, 452)

printEvens(2048, 2188)

deck = [["2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "XC", "JC", "QC", "KC","AC"],

["2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "XD", "JD", "QD", "KD", "AD"],

["2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", "XH", "JH", "QH", "KH", "AH"],

["2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "XS", "JS", "QS", "KS", "AS"]

]

coords=["22", "0A", "38", "1B", "25"]

rv = generatePokerHand(deck, coords)

coords=["23", "24", "25", "26", "27"]

rv = generatePokerHand(deck, coords)

# end main( )

if __name__ == "__main__" :

main( )

Q5. Write a function named 'generatePokerHand' that accepts the following

2 dimensional array of strings called 'deck':

deck = [["2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "XC", "JC", "QC", "KC","AC"],

["2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "XD", "JD", "QD", "KD", "AD"],

["2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", "XH", "JH", "QH", "KH", "AH"],

["2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "XS", "JS", "QS", "KS", "AS"]

]

and an array of 5 strings called 'coords' such that each string consists of only

the following characters:

the first character (representing rows) will only ever be either a '0', '1, '2', '3', and

the second character (representing columns) will only ever be either '0' to '9', and 'A', 'B', or 'C'.

So for example, sample coords strings will be "22", "0A", "38", "1B", etc.

You may assume the 'coords' strings will ALWAYS be valid.

This function converts each string in the 'coords' array into 2 valid integers (0 to 3 for rows)

and (0 to 12 for columns) and then accesses the 2D array at those coordinates and "glues" the

result into a string such that each element is separated with the "-" character.

For example, if the 'coords' strings contained: "22", "0A", "38", "1B", "25", then

the resultant string returned would be:

"4H-QC-XS-KD-7H".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!