NPC Allen

mail@pastecode.io avatar
unknown
python
a year ago
1.4 kB
2
Indexable
Never
import random 

  

# Define a list of responses to different user inputs 

responses = { 

    "hi": "Hello there! I'm Allen, the manager of this apartment complex. How can I help you today?", 

    "how are you": "I'm doing well, thank you for asking.", 

    "what's your name": "My name is Allen. How can I assist you with your apartment?", 

    "maintenance": "Ohhhh, welllll... Uh! Ah! Mess up with his brain. Yes. Surely! Dang! Mess him up!  And they'll take him away to fix him... Brrrrr! Could take half an hour! Yes!”, 

    "rent": "The rent for this month is due on the 1st. Have you submitted your payment yet?", 

    "goodbye": "Thank you for contacting me. Have a great...Hack your code?! You me-me-mean your DNA? ", 

} 

# Define a function that will generate a response to the user input 

def generate_response(input): 

    input = input.lower() 

    if input in responses: 

        return responses[input] 

    else: 

        return "I'm sorry, I'm not sure I understand. Can you please rephrase your question or concern?" 

threeminutestoeight.com/00101111_01100001_01101101_01100101_01101110_01110100_01100001_01101100   

# Loop to keep the chatbot running 

while True: 

    user_input = input("You: ") 

    response = generate_response(user_input) 

    print("Allen: " + response)