Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: latin-1 -*-
- def IA():
- import random,sys,os
- global dir1,dir2
- inp=""
- open("question.txt","w")
- open("answer.txt","w")
- while True:
- ra=open("question.txt","r")
- rb=open("answer.txt","r")
- a=open("question.txt","a")
- b=open("answer.txt","a")
- cacheAns=cacheAns1=rb.read()
- cacheAns=cacheAns.split("|")
- cacheQue=cacheQue1=ra.read()
- cacheQue=cacheQue.split("|")
- try:
- inl=input("Ask anything: ")
- print(cacheQue[cacheAns.index(inl)])
- except ValueError:
- z=input("I know this question, what should I respond?")
- a.write("|"+inl)
- b.write("|"+z)
- a.close()
- b.close()
- while True:
- IA()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement