Exemplo n.º 1
0
def is_number_prime(number: int, json: bool = False):
    div_count = 0
    if number == 2:
        return True
    elif number == 1:
        return False
    else:
        for i in range(1, (round(math.sqrt(number)) + 1)):
            if number % i == 0:
                div_count += 1
            if div_count > 1:
                break
        if div_count == 1:
            is_prime = True
        else:
            is_prime = False
    return magic(response_value=is_prime, json=json)
Exemplo n.º 2
0
def get_8ball(json: bool = False):
    answer = random.choice([
        "It is certain.",
        "It is decidedly so.",
        "Without a doubt.",
        "Yes – definitely.",
        "You may rely on it.",
        "As I see it, yes.",
        "Most likely.",
        "Outlook good.",
        "Yes.",
        "Signs point to yes.",
        "Reply hazy, try again.",
        "Ask again later.",
        "Better not tell you now.",
        "Cannot predict now.",
        "Concentrate and ask again.",
        "Don’t count on it.",
        "My reply is no.",
        "My sources say no.",
        "Outlook not so good.",
        "Very doubtful.",
    ])
    return magic(response_value=answer, json=json)
Exemplo n.º 3
0
def get_coinflip(json: bool = False):
    answer = random.choice(["head", "tail"])
    return magic(response_value=answer, json=json)
Exemplo n.º 4
0
def get_up(json: bool = False):
    return magic(response_value=True, json=json)
Exemplo n.º 5
0
def should_you_live_in_lithuania(json: bool = False):
    #todo update to True, when the situation changes
    return magic(response_value - False, json=json)
Exemplo n.º 6
0
def get_len(input: str, json: bool = False):
    _len = len(input)
    return magic(response_value=_len, json=json)
Exemplo n.º 7
0
def get_is_even(number: int, json: bool = False):
    is_even = not (number & 1 == 1)
    return magic(response_value=is_even, json=json)