Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ChatBotGroup/updatedRestaurantsSearch.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
31 lines (21 sloc)
981 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
conn = sqlite3.connect('chatbot.db') | |
c = conn.cursor() | |
def restaurants(): | |
response = input("Who are you going out to eat with? \n") | |
words = response.split(" ") | |
if "boyfriend" in words or "girlfriend" in words: | |
print("The restaurants below have been selected as being suited for you.") | |
for row in c.execute('SELECT name FROM restaurants WHERE mood = "Romantic" '): | |
print(row) | |
elif "friend" in words or "friends" in words: | |
print("The restaurants below have been selected as being suited for you.") | |
for row in c.execute('SELECT name FROM restaurants WHERE mood = "Casual" '): | |
print(row) | |
elif "myself" in words or "alone" in words: | |
print("The restaurants below have been selected as being suited for you.") | |
for row in c.execute('SELECT name FROM restaurants WHERE mood = "Cosy" '): | |
print(row) | |
else: | |
print("This is not an option") | |
restaurants() |