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?
Python-Chatbot/main2.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
36 lines (35 sloc)
1.3 KB
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
'''main program''' | |
def main2(): | |
greeting=["hi","hello","greetings","greet","greeting"] | |
user=input("Hello, how can I help you? ") | |
if user.lower() in greeting: | |
print("I am Chatter, your personal social companion. :) ") | |
else: | |
print("Sorry, what do you want?") | |
while True: | |
try: | |
print("Service list: \n(a)\tWeather \n(b)\tMusic \n(c)\tSocial") | |
user=input("Enter your service needed (please type letters): ") | |
except ValueError: | |
print("Invalid input!") | |
else: | |
if user.isalpha()==False: | |
print("Invalid input!") | |
continue | |
if user.lower() in ["a","b","c"]: | |
if (user.lower()).strip() == "a": | |
import weather_realtime | |
elif (user.lower()).strip() == "b": | |
import web | |
elif (user.lower()).strip() == "c": | |
from chat2 import greet | |
greet() | |
else: | |
from parrot import MainParrot | |
user=input("Are you sure to quit?(yes) ") | |
if user.lower() in ["yes"]: | |
break | |
else: | |
continue | |
print("Goodbye man!") | |
'''main program ends''' |