1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] python function function is not being called?

Discussão em 'Python' iniciado por Stack, Janeiro 24, 2025.

  1. Stack

    Stack Membro Participativo

    So the function I want to be called is not working and another function is being called.


    def random_game(user_input):
    if "random number" in user_input and "play" in user_input:
    print("Okay! We'll play the Random Number game!! ")
    random_num_game()
    return None
    else:
    return "Sorry, I can't understand that."

    def calc_culator(user_input):
    if "calculator" in user_input:
    print("Sure tell what to do! ")
    calculator_mode()
    return None
    else:
    return "Sorry I can't understand that."


    The above code is the one that is being called, but the one I want is not.

    def dod():
    print("Dod: Yo! What do you want to do today champ? ")
    while True:
    user_input = input("User: ").lower()
    if user_input in ["exit", "cancel"]:
    print("Okay I'll turn off now.")
    break
    response = random_game(user_input)
    if response:
    print(f"Dod: {response}")
    response_2 = calc_culator(user_input)
    if response_2:
    print(f"Dod: {response_2}")


    This is the function that should show up in output at first. If it helps, I am importing the above 2 functions from my other codes. Could anyone tell what I am doing wrong??

    Continue reading...

Compartilhe esta Página