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?
Eggy-Chat-Bot-/newsport.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
93 lines (68 sloc)
3.85 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
# import os and sys to enable autorun | |
import os | |
import sys | |
def lunchchat(): | |
import random | |
greetuser = ['good day, this is mike your sportnews chatbot. Need a sports update?', | |
' right here, need me for the sports news today?', | |
'do you need any information about the sports?'] | |
random_index = random.randrange(len(greetuser)) | |
return ''.join(random.sample(greetuser, 1)) | |
# added line break to give space on autorun | |
print("\n\ni am mike your sportnews chatbot " + lunchchat()) | |
def footballresults(): | |
import random | |
footballdata = ['football is the most famous sport in the world\n watched by so many people in the world with about a billion people'+ | |
' ,the sport generates tons of revenue and is the most played sport\n generating about 4.6 billion dollars in revenue'+ | |
' football has so many different kind of leagues across the continent \n and in the world, for football'+ | |
' being a sport that involves two teams the sport of football can be very competitive\n,which involves the two teams trying'+ | |
' to put the ball in a net of the goal posts of both opposite teams,over the years the sport\n of football has become a lucrative'+ | |
' profession for footballers making footballers even have luxurious lifestyles that regular jobs can not\n even provide.'] | |
random_index = random.randrange(len(footballdata)) | |
return ''.join(random.sample(footballdata, 1)) | |
def boxingresults(): | |
import random | |
boxingdata = [' Boxing is a combative sport and arguably the most dangerous sport in the world!!\n involving two oponents fighting, which of them trying'+ | |
' to knock out the other with serious blows to the upper body consisting of 12 rounds with each round of 3 minutes each\n and beecause '+ | |
' of the kinda sport boxing is,fights are broken down to several weight classes from flyweight up all to heavyweight\n this modern day'+ | |
' boxers wear gloves it was not so several decades ago,several decades ago boxers used to box bearknuckled making it very brutal\n but it'+ | |
' is not so anymore,this present day boxing is a very lucrative sport making it one of the most lucrative sport in the world\n with boxers '+ | |
'making millions of dollars per fight.'] | |
random_index = random.randrange(len(boxingdata)) | |
return ''.join(random.sample(boxingdata, 1)) | |
# define function for sport news | |
def sportNews(): | |
print("what sports would like like to know to know about?") | |
userchoice = input("") | |
userchoicewords = ['football'] | |
boxingchoice = ['boxing'] | |
userchoice_reply = userchoice.split() | |
for words in userchoice_reply: | |
if userchoice in userchoicewords: | |
print("Result: " + footballresults()) | |
elif userchoice in boxingchoice: | |
print("Result: " + boxingresults()) | |
elif userchoice not in userchoicewords or boxingchoice: | |
print('i do not understand,kindly type yes or yeah') | |
userreply = input("") | |
print("what sports would you like to know to know about?") | |
sportreply = input("") | |
else: | |
print("what sports would you like to know to know about?") | |
sportreply = input("") | |
# elif words in keywords : | |
# print('sorry our system is down try again later') | |
# sportreply = input("" | |
userreply = input("") | |
keywords = ['yes', 'Yes', 'YES'] | |
received_reply = userreply.split() | |
for words in received_reply: | |
if words in keywords: | |
answer = words | |
# define function before implementation | |
sportNews() | |
# you need to to state other option for computer | |
else: | |
print('i do not understand,kindly type yes or yeah') | |
# restart script | |
os.execl(sys.executable, sys.executable, *sys.argv) |