def test_number_multiplication():
    # Enter a random number and save it in variable number_1. Then create function number_multiplication which will
    # return a result of multiplication of digits this number.
    if number_multiplication(number_1) == None or number_1 == None:
        pytest.skip(
            f"You didn't finish this task. the result variable equals None")
    result = 0
    num_string = str(number_1)
    length = len(num_string)
    index = 0
    while index < length:
        result *= int(num_string[index])
        index += 1
    assert number_multiplication(number_1) == result
Exemple #2
0
def test_number_multiplication():
    # Enter a random number and save it in variable number_1. Then create a function number_multiplication
    # that will multiply all the digits together and return the result.
    if number_multiplication(number_1) == None or number_1 == None:
        pytest.skip(
            f"You didn't finish this task. the result variable equals None")
    result = 1
    num_string = str(number_1)
    length = len(num_string)
    index = 0
    while index < length:
        result *= int(num_string[index])
        index += 1
    assert number_multiplication(number_1) == result
Exemple #3
0
def test_number_reverse():
    # Enter a random number and save it in variable number_2. Then create function number_reverse which will return
    # a number with digits of number_1 in reverse order
    if number_reverse(number_2) == None or number_2 == None:
        pytest.skip(
            f"You didn't finish this task. the result variable equals None")
    num_string = str(number_2)
    index = len(num_string)
    result = ''
    while index > 0:
        result += num_string[index - 1]
        index -= 1
    assert number_multiplication(number_1) == int(result)