Esempio n. 1
0
def two_greatest_items(test_list):
    """
	Problem Statement-
		Given test_list return the two greatest
        items in that list as a new list in sorted
        order.

	Input-
	a. test_list: list

	Output-
	    The function should return a new list with the two
        greatest items in a sorted order. If list size is 1,
		return only one item.

	Example-
		>>> two_greatest_items([44, 32, 7, 9])
		[32, 44]

		>>> two_greatest_items([5])
		[5]
	"""
    pass


if __name__ == '__main__':
    import doctest
    doctest.testmod(verbose=True)
    from test_lists_beginner import test_one
    test_one('test_two_greatest_items')
def reverse_and_delimiter(test_list, delimiter):
    """
	Problem Statement-
		Given test_list and a delimiter, return a list
        separated by the delimiter in reverse order.

	Input-
	a. test_list: list

    b. delimiter: str

	Output-
	    The function should return a new list in a reverse order
        and its values separated by the delimiter.

	Example-
		>>> reverse_and_delimiter(["Hello", "there!", "How", "are", "you?"], "->")
		["you?", "->", "are", "->", "How", "->", "there!", "->", "Hello,"]

		>>> reverse_and_delimiter(["Car", "Bus", "Motorcycle", "Airplane", "Truck"], "!")
		["Truck", "!", "Airplane", "!", "Motorcycle", "!", "Bus", "!", "Car"]
	"""
    pass


if __name__ == '__main__':
    import doctest
    doctest.testmod(verbose=True)
    from test_lists_beginner import test_one
    test_one('test_reverse_and_delimiter')
    """
	Problem Statement-
		Given test_list, bottom and top,
        between bottom and top thresholds. (INCLUSIVE)

	Input-
	a. test_list: list

    b. bottom: int

    c. top: int

	Output-
	    The function should return a new list with all its values
        between bottom and top.

	Example-
		>>> in_between_bottom_and_top([27, 32, 7, 64, 40, 21, 13], 5, 40)
		[27, 32, 7, 40, 21, 13]

		>>> in_between_bottom_and_top([-32, 93, 65, 1, 100], -100, 10)
		[-32, 1]
	"""
    pass
    
if __name__ == '__main__':
    import doctest
    doctest.testmod(verbose=True)
    from test_lists_beginner import test_one
    test_one('test_in_between_bottom_and_top')
Esempio n. 4
0
__author__ = "John Doe"


def multiple_integers_to_single_integer(test_list):
    """
    Problem Statement-
        Given test_list, convert a list of multiple
        integers into a single integer.

    Input-
    a. test_list: list

    Output-
        The function should return a integer value

    Example-
        >>> multiple_integers_to_single_integer([1, 7, 3, 21, 14])
        1732114

        >>> multiple_integers_to_single_integer([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
        12345678910
    """
    pass


if __name__ == '__main__':
    import doctest
    doctest.testmod(verbose=True)
    from test_lists_beginner import test_one
    test_one('test_multiple_integers_to_single_integer')
    """
	Problem Statement-
		Given test_list and word return a new list
        with the value of 'test_word' concatenated to
        every item in the 'test_list'.

	Input-
	a. test_list: list

    b. test_word: str

	Output-
	    The function should return a new list with all its words
        concatenated with 'test_word'.

	Example-
		>>> concatenating_word(["Brownie", "Pizza", "Computer", "Electron"], "Pie")
		["BrowniePie", "PizzaPie", "ComputerPie", "ElectronPie"]

		>>> concatenating_word(["Python", "GitHub", "Commit"], "Code")
		["PythonCode", "GitHubCode", "CommitCode"]
	"""
    pass


if __name__ == '__main__':
    import doctest
    doctest.testmod(verbose=True)
    from test_lists_beginner import test_one
    test_one('test_concatenating_word')