MCPcopy Create free account
hub / github.com/geekcomputers/Python / get_players

Function get_players

RandomNumberGame.py:28–45  ·  view source on GitHub ↗

Prompt to enter `n` player names. Args: n (int): number of players Returns: List[str]: list of player names Example: >>> import builtins >>> inputs = iter(["Alice", "Bob"]) >>> builtins.input = lambda prompt="": next(inputs) >>> get

(n: int)

Source from the content-addressed store, hash-verified

26
27
28def get_players(n: int) -> List[str]:
29 """
30 Prompt to enter `n` player names.
31
32 Args:
33 n (int): number of players
34
35 Returns:
36 List[str]: list of player names
37
38 Example:
39 >>> import builtins
40 >>> inputs = iter(["Alice", "Bob"])
41 >>> builtins.input = lambda prompt="": next(inputs)
42 >>> get_players(2)
43 ['Alice', 'Bob']
44 """
45 return [input("Enter name of player: ") for _ in range(n)]
46
47
48def play_turn(player: str) -> int:

Callers 1

play_gameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected