Please answer it in Python Write a function init_line that takes as an argument a pickaxe list corresponding to the list of cards after distribution of cards to players. This function removes the first 4 cards from the deck (it is assumed that there are suffisamment) and uses them to start the 4 lines of the game board. It therefore returns a dictionary according to the format defini in part 3 (key = line number, associated value = list of cards in the line). The first card of the pickaxe will go to the first line, and so on. The function also has an edge effet: it modifies pickaxe. For example: Card =[74, 72, 59, 82, 44, 77, 17, 11, 62, 97, 83, 69, 100, 22, 4, 51, 55, 50, 103, 52, 13, 25, 38, 37, 29, 104, 47, 23, 39, 80, 49, 98, 8, 78, 26, 46, 86, 18, 93, 31, 27, 34, 85, 84, 76, 87, 65, 35, 81, 79, 101, 66, 20, 91, 73, 16, 102, 42, 40, 70, 90, 7, 6, 64, 14, 67, 43, 12, 58, 1, 63, 2, 75, 32, 48, 96, 3, 15, 99, 68, 53, 61, 56, 92, 36, 28, 19, 5, 24, 45, 57, 94, 21, 54, 88, 33, 10, 71, 30, 95, 9, 41, 60, 89] init_line(card) #return=> {‘line 1’: 74, 'line 2':72, ‘line 3’: 59, ‘line 4’: 82}
Please answer it in Python
Write a function init_line that takes as an argument a pickaxe list corresponding to the list of cards after distribution of cards to players. This function removes the first 4 cards from the deck (it is assumed that there are suffisamment) and uses them to start the 4 lines of the game board. It therefore returns a dictionary according to the format defini in part 3 (key = line number, associated value = list of cards in the line). The first card of the pickaxe will go to the first line, and so on. The function also has an edge effet: it modifies pickaxe.
For example:
Card =[74, 72, 59, 82, 44, 77, 17, 11, 62, 97, 83, 69, 100, 22, 4, 51, 55, 50, 103, 52, 13, 25, 38, 37, 29, 104, 47, 23, 39, 80, 49, 98, 8, 78, 26, 46, 86, 18, 93, 31, 27, 34, 85, 84, 76, 87, 65, 35, 81, 79, 101, 66, 20, 91, 73, 16, 102, 42, 40, 70, 90, 7, 6, 64, 14, 67, 43, 12, 58, 1, 63, 2, 75, 32, 48, 96, 3, 15, 99, 68, 53, 61, 56, 92, 36, 28, 19, 5, 24, 45, 57, 94, 21, 54, 88, 33, 10, 71, 30, 95, 9, 41, 60, 89]
init_line(card)
#return=> {‘line 1’: 74, 'line 2':72, ‘line 3’: 59, ‘line 4’: 82}
Step by step
Solved in 3 steps with 1 images