편집 기록

편집 기록
  • 프로필 엽토군님의 편집
    날짜2018.10.16

    파이썬 질문


    def Greeting(sentence) :
    
        Greeting_Keywords = ["ㅎㅇ","하이","안녕","안뇽"]
    
        Greeting_Responses = ["ㅎㅇ","하이","안녕","안녕하세요"]
    
        for word in sentence:
            if word.lower() in Greeting_Keywords :
                return random.choice(Greeting_Responses)
    
    question = input('입력: ')
    
    print(Greeting(question))
    

    파이썬으로 챗봇을 구현하려고 하는데 실행하면

    입력: 안녕
    None
    

    이렇게 나오네요.
    특정 구문이 포함된 문장을 입력하면 설정해둔 답변 중 하나가 나오게 하고 싶은데 어떻게 하면 될까요?

  • 프로필 박민아님의 편집
    날짜2018.10.16

    파이썬 질문


    def Greeting(sentence) :

    Greeting_Keywords = ["ㅎㅇ","하이","안녕","안뇽"]
    
    Greeting_Responses = ["ㅎㅇ","하이","안녕","안녕하세요"]
    
    for word in sentence:
        if word.lower() in Greeting_Keywords :
            return random.choice(Greeting_Responses)
    

    question = input('입력: ')

    print(Greeting(question))

    파이썬으로 챗봇을 구현하려고 하는데 실행하면

    입력: 안녕 None

    이렇게 나오네요. 특정 구문이 포함된 문장을 입력하면 설정해둔 답변 중 하나가 나오게 하고 싶은데 어떻게 하면 될까요?