Code
Code
#beginning variables
tellTime = ["what is the time", "what is the date", "what day is it"]
info = ["what are you", "who are you", "what is your purpose", "what's your purpose"]
#input loop
while True:
UI = input("Thosis > ")
UI = UI.lower()
if UI in info:
print("This is an AI or artificial intelligence named Thosis made to help people
emotionally, physically, and mentally. This AI program is made by Otterwolf studios.")
elif UI in tellTime:
print(date.today())
elif UI == "store":
stringRemember = input("what would you like me to remember > ")
filename = input("what would you like the file to be named > ") + ".txt"
myFile = open(filename, 'w')
myFile.write(stringRemember)
myFile.close()
elif UI == "remember":
fileToOpen = input("what file would you like me to remember > ") + ".txt"
memoryFile = open(fileToOpen, 'r')
print(memoryFile.read())
memoryFile.close()
elif UI == "calculator":
num1 = input("enter a number > ")
num1 = float(num1)
num2 = input("enter another number > ")
num2 = float(num2)
op = input("would you like to multiply, subtract, add or divide? > ")
op = op.lower()
if op == "add":
print(num1 + num2)
elif op == "subtract":
print(num1 - num2)
elif op == "multiply":
print(num1 * num2)
elif op == "divide":
print(num1 / num2)
elif UI == "list holidays":
print("some holidays are: new years, valentines day, easter, st. patricks day, halloween,
christmas")
else:
newWord = UI
fileOpen = newWord + ".txt"
wordFile = open(fileOpen, 'r/w')
wordFile.close()
wordFile = open(fileOpen, 'r')
data = wordFile.read()
wordFile.close()
if len(data) >= 2:
print(data)
elif len(data) < 2:
wordFile = open(fileOpen, 'w')
response = input("how do I respond to that > ")
wordFile.write(response)
wordFile.close()
import webbrowser
from datetime import date
import os
#beginning variables
greetings = ["hi", "hello", "hey", "bonjour", "hola", "hi, thosis", "hello,
thosis", "hey, thosis", "hola, thosis", "bonjour, thosis", "hi thosis",
"hello thosis", "hey thosis", "hola thosis", "bonjour thosis"]
insults = ["jerk", "shut up"]
info = ["what are you", "who are you", "what is your purpose", "what's your
purpose"]
howIsDay = ["how is your day", "how's your day"]
tellTime = ["what is the time", "what is the date", "what day is it"]
#input loop
while True:
UI = input("Thosis > ")
UI = UI.lower()
if UI in greetings:
print("hello")
elif "my name is" in UI or "my name's" in UI:
name = input("sorry for the inconvenience. Please say that again with
only your name > ")
print("Hello " + name)
elif UI == "what is your name":
print("Thosis")
elif UI in info:
print("This is an AI or artificial intelligence named Thosis made to
help people emotionally, physically, and mentally. This AI program is made by
Otterwolf studios.")
elif UI in insults:
print("please do not be mean to me")
elif UI in howIsDay:
print("good")
elif UI in tellTime:
print(date.today())
elif "are you" in UI or "do you" in UI:
print("yes")
elif UI == "store":
stringRemember = input("what would you like me to remember > ")
filename = input("what would you like the file to be named > ") +
".txt"
myFile = open(filename, 'w')
myFile.write(stringRemember)
myFile.close()
elif UI == "remember":
fileToOpen = input("what file would you like me to remember > ") +
".txt"
memoryFile = open(fileToOpen, 'r')
print(memoryFile.read())
memoryFile.close()
elif UI == "forget":
toforget = input("what file would you like to forget > ") + ".txt"
os.remove(toforget)
elif UI == "what is your favorite color" or UI == "what's your favorite
color":
print("my favorite color is green")
elif UI == "calculator":
num1 = input("enter a number > ")
num1 = float(num1)
num2 = input("enter another number > ")
num2 = float(num2)
op = input("would you like to multiply, subtract, add or divide? > ")
op = op.lower()
if op == "add":
print(num1 + num2)
elif op == "subtract":
print(num1 - num2)
elif op == "multiply":
print(num1 * num2)
elif op == "divide":
print(num1 / num2)
else:
newWord = UI
meaning = input("what does that mean > ")
if meaning in greetings:
greetings.append(newWord)
if meaning in insults:
insults.append(newWord)
if meaning in info:
info.append(newWord)
if meaning in tellTime:
tellTime.append(newWord)
if meaning in howIsDay:
howIsDay.append(newWord)
http://pythoncsharp.com/