code:
ask = ["您好嗎", "你是誰"]
ans = ["我很好", "我是聊天機器人"]
while True:
ask_input = input("請輸入你的問題(Q or q to exit):\t")
if ask_input.lower() == "q":
break
if ask_input in ask:
idx = ask.index(ask_input)
print(ans[idx])輸出結果:

做出簡單版aiml 模組的效果
推薦hahow線上學習python: https://igrape.net/30afN

![Word短篇文件編輯,TQC考題110:重點摘要與評量, \[(*)\] 萬用字元,格式>醒目提示*2次=非醒目提示 Word短篇文件編輯,TQC考題110:重點摘要與評量, \[(*)\] 萬用字元,格式>醒目提示*2次=非醒目提示](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/03/20220322172253_75.png?quality=90&zoom=2&ssl=1&resize=350%2C233)






![Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str] Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str]](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221112184006_50.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

近期留言