Exemple #1
0
def get_question_and_right_answer():

    random_number1 = random_wrapper.get_random_number(MIN_RANDOM, MAX_RANDOM)
    random_number2 = random_wrapper.get_random_number(MIN_RANDOM, MAX_RANDOM)

    question = f'{random_number1} {random_number2}'

    right_answer = gcd(random_number1, random_number2)

    result = (question, str(right_answer))

    return result
Exemple #2
0
def get_question_and_right_answer():

    random_operation = choice(OPERATIONS)
    random_number1 = random_wrapper.get_random_number(1, 20)
    random_number2 = random_wrapper.get_random_number(1, 20)

    question = f'{random_number1} {random_operation} {random_number2}'

    arithmetic_execution_result = \
        safe_arithmetic_execution(random_operation,
                                  random_number1,
                                  random_number2)
    result = (question, str(arithmetic_execution_result))

    return result
Exemple #3
0
def get_question_and_right_answer():
    random_number = random_wrapper.get_random_number(MIN_RANDOM, MAX_RANDOM)
    question = str(random_number)

    right_answer = 'yes' if random_number % 2 == 0 else 'no'

    result = (question, right_answer)

    return result
Exemple #4
0
def get_question_and_right_answer():

    random_number = random_wrapper.get_random_number(MIN_RANDOM, MAX_RANDOM)
    question = str(random_number)

    right_answer = "yes" if is_prime(random_number) else "no"

    result = (question, right_answer)

    return result
Exemple #5
0
def get_question_and_right_answer():

    progression_step = random_wrapper.get_random_number(MIN_RANDOM, MAX_RANDOM)
    start_number = random_wrapper.get_random_number(MIN_RANDOM, MAX_RANDOM)

    progression = [
        start_number + progression_step * counter
        for counter in range(PROGRESSION_LENGTH)
    ]

    position_of_missing_element = random_wrapper.\
        get_random_number(0, PROGRESSION_LENGTH - 1)

    question = get_question(progression, position_of_missing_element)

    right_answer = progression[position_of_missing_element]

    result = (question, str(right_answer))

    return result