Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions exercises/concept/card-games/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
def get_rounds(number):
"""Create a list containing the current and next two round numbers.

:param number: int - current round number.
:return: list - current round and the two that follow.
Parameters:
number (int): The current round number.

Returns:
list: The current round number and the two that follow.
"""

pass
Expand All @@ -17,9 +20,12 @@ def get_rounds(number):
def concatenate_rounds(rounds_1, rounds_2):
"""Concatenate two lists of round numbers.

:param rounds_1: list - first rounds played.
:param rounds_2: list - second set of rounds played.
:return: list - all rounds played.
Parameters:
rounds_1 (list): The first rounds played.
rounds_2 (list): The second group of rounds played.

Returns:
list: All rounds played.
"""

pass
Expand All @@ -28,9 +34,12 @@ def concatenate_rounds(rounds_1, rounds_2):
def list_contains_round(rounds, number):
"""Check if the list of rounds contains the specified number.

:param rounds: list - rounds played.
:param number: int - round number.
:return: bool - was the round played?
Parameters:
rounds (list): The rounds played.
number (int): The round number.

Returns:
bool: Was the round played?
"""

pass
Expand All @@ -39,8 +48,11 @@ def list_contains_round(rounds, number):
def card_average(hand):
"""Calculate and returns the average card value from the list.

:param hand: list - cards in hand.
:return: float - average value of the cards in the hand.
Parameters:
hand (list): The cards in the hand.

Returns:
float: The average value of the cards in the hand.
"""

pass
Expand All @@ -49,8 +61,11 @@ def card_average(hand):
def approx_average_is_average(hand):
"""Return if the (average of first and last card values) OR ('middle' card) == calculated average.

:param hand: list - cards in hand.
:return: bool - does one of the approximate averages equal the `true average`?
Parameters:
hand (list): The cards in the hand.

Returns:
bool: Does one of the approximate averages equal the `true average`?
"""

pass
Expand All @@ -59,8 +74,11 @@ def approx_average_is_average(hand):
def average_even_is_average_odd(hand):
"""Return if the (average of even indexed card values) == (average of odd indexed card values).

:param hand: list - cards in hand.
:return: bool - are even and odd averages equal?
Parameters:
hand (list): The cards in the hand.

Returns:
bool: Are the even and odd averages equal?
"""

pass
Expand All @@ -69,8 +87,11 @@ def average_even_is_average_odd(hand):
def maybe_double_last(hand):
"""Multiply a Jack card value in the last index position by 2.

:param hand: list - cards in hand.
:return: list - hand with Jacks (if present) value doubled.
Parameters:
hand (list): The cards in the hand.

Returns:
list: The hand with Jacks (if present) value doubled.
"""

pass
Loading