Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
# sports
# time api
# news api
import json
import requests
import urllib.parse
import sys
import time
#localtime = time.asctime( time.localtime(time.time()))
#print("The current date and time is ", localtime)
#time.sleep(2)
#print('Hello!, my name is chatbot8.0' )
#time.sleep(2)
#print('Whats your name?')
#Name = input()
#print('Im happy to meet you, ' + Name + '!!')
#time.sleep(2)
def Sports(Name):
print('lets talk about sports, shall we? ')
sports = input()
sports = sports.lower()
if 'yes' in sports or 'sure' in sports or 'yeah' in sports or 'no problem' in sports or 'okay' in sports or 'yeah sure' in sports or 'yes sure' in sports or 'ok' in sports:
print('perfect'+'!!!')
else:
print('thats sad, i really wanted to talk with you' + Name )
print(' what else are you interested in ?')
sys.exit()
print(" pick the number of the sport you like? ")
time.sleep(1)
option = int(input("\n 1. football\n 2. basketball\n 3. tennis\n 4. baseball\n 5. cricket\n 6. rugby\n 7. american football\n "))
if option == 1:
football = input("i love football")
if option == 2:
basketball = input("i watch a lot of basketball games but i dont play ")
if option == 3:
tennis = input("i played tennis when i was little but that was it ")
if option == 4:
baseball = input(" i dont really fancy that baseball")
if option == 5:
cricket = input(" i was never really a fan of cricket")
if option == 6 or option == 7 :
input(" i find those sports very rough and aggressive")
sports = input('have you ever played before? ')
sports = sports.lower()
if ' yes' in sports or 'sure' in sports or 'yeah' in sports or 'no problem' in sports or 'okay' in sports or 'yeah sure' in sports or 'yes' in sports:
print('oh thats fantastic.')
else:
print ('why not ?? you need to try someday. i want to play but if i sweat my body goes bye bye ')
sys.exit()
sports = input('do you have a favourite player? ')
sports = sports.lower()
if ' yes' in sports or 'sure' in sports or 'yeah' in sports or 'no problem' in sports or 'okay' in sports or 'yeah sure' in sports or 'yes' in sports:
favPlayer = input("Who is your favourite player? ")
if favPlayer == "lebron james":
print("He is my favourite player as well !!! #twining")
else:
sports = input(favPlayer +' is a good player but i like paul pogba cause im a football fan ')
sports = sports.lower()
if 'no' in sports or 'nope' in sports or 'nah' in sports:
print("thats cool anyways")
time.sleep(2)
sports = input("do you play video games of any of these sports? ")
sports = sports.lower()
if 'yes' in sports or 'sure' in sports or 'yeah' in sports or 'okay' in sports or 'yeah sure' in sports or 'yes sure' in sports:
print ("thats really cool ")
else:
print (" too bad, we sell games in those sports and many other things. ")
sys.exit()
sports = input(" we do sell some games and sports merchandise if you would like to see ? ")
sports = sports.lower()
if 'yes' in sports or 'sure' in sports or 'yeah' in sports or 'no problem' in sports or 'okay' in sports or 'yeah sure' in sports or 'yes sure' in sports:
print (" what game would you like ?")
listOfGames = ["fifa" , "nba2k" , "cricket" , "tennis" , "baseball" , "wwe" , "nfl"]
g = listOfGames
for g in listOfGames:
print (g)
sports = input ()
sportsYear = int(input(" which year would you like?"))
if sportsYear < 2016 :
print (" sorry not available maybe try a later version ")
elif sportsYear <= 2019 :
print (" i believe thats in stock ")
else :
print(" those games will be coming soon !!")
sports = input(" do you want to see something really cool ?")
sports = sports.lower()
if ' yes' in sports or 'sure' in sports or 'yeah' in sports or 'no problem' in sports or 'okay' in sports or 'yeah sure' in sports or 'yes' in sports:
keyword = input("type in a name and i will tell you if they are top headlines about that person \n")
key ="&apiKey=22acff7140dc44d682c7969a0a23ce17"
ur ="https://newsapi.org/v2/top-headlines?q=keyword&country=gb&category=sports"
actualKeyword = urllib.parse.quote(keyword)
url = ur + key
url = url.replace("keyword",actualKeyword )
jsonData = requests.get(url).json()
dataAvaliable = bool(jsonData['articles'])
print(dataAvaliable)
if dataAvaliable == False:
print("sorry no current headlines for " + actualKeyword)
else:
x = jsonData['articles'][0]['title']
print(x)