tutorial-idently/responses.py
2025-04-03 21:56:53 +02:00

21 lines
618 B
Python

from random import choice, randint
def get_response(user_input: str) -> str:
lowered: str = user_input.lower()
if lowered == '':
return 'Gut, du bist sehr still ...'
elif 'hello' in lowered:
return 'Hello there!'
elif 'how are you' in lowered:
return 'Good, Thanks!'
elif 'bye' in lowered:
return "See you later!"
elif 'roll dice' in lowered:
return f'you rolled: {randint(1, 6)}'
else:
return choice(['I do not understand...',
'What are you talking abaout?',
'Do you mind rephrasing that?'])