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
import urllib.parse
import urllib.request
import json
#import requests
import urllib.request, json
rpy = input("Hello user, what's your name?")
choice = int(input("Hello "+rpy+", what do you want to talk about?\n1. The Weather\n2. Video Games\n3. Phones\n"))
# +rpy+ takes the users input and puts it into to the new variable.
powerbank = "no"
if choice == 1:
weather_responce = input("")
if choice == 2:
vid_choice = input("Whats your favourite video game?")
if choice == 3:
phone_choice = input("What do you prefer Android or Ios?")
s = phone_choice
print(s.lower())
#by using s.lower this takes the user's input and converts it into lowercase characters.
phone_choice = input("Not a bad choice but to be honest, they are both great platforms. "
"I'm more of a android person.\nHave you ever used the music App?")
if phone_choice == "yes" or phone_choice == "YES" or phone_choice == "yeah" or phone_choice == "yeah":
App = input("Nice! What other Apps do you like? Any specific Apps?")
if App == "Music" or App =="Facebook" or App =="Instagram" or App =="Snapchat" or App =="whatsapp" or App == "music" or App =="facebook" or App =="instagram" or App =="snapchat" or App =="whatsapp":
questions = input("Not bad, that app is quite reliable. I'm more into Twitter myself\n Would you like to carry on with this topic?")
if questions == "yes" or questions == "Yes":
print()
elif questions == "no" or questions == "No" :
print ("Thank you for your time you may end the chat now.")
exit()
#if the user chooses not to carry on this will stop the chatbot
if questions == "yes" or questions == "Yes" :
print ("fantastic lets proceed to the questions")
nation = input("Are we becoming a mobile/smartphone driven nation Yes or No?")
if nation == "yes" or nation == "Yes" :
print ("I agree as 62.9 percent of the population in the world already owned a mobile phone this percentage is only going up!")
x = input("Has the number of cheating cases among students increased or decreased in your community? ")
if x == "increased" or x == "decreased" or x == "Increased" or x == "Decreased":
print ("I believe that cheating has increased it is now statistically quoted that 20 to 28 percent of people cheat.")
elif nation == "no":
print("thank you for your opinion")
else:
print("I dont recognise this, please enter a valid input")
else:
print("Sorry I dont recognise that, please enter a valid input")
option = int(input("We are now going to move on to Mobile Phones hardware equitment here are the 3 sections please choose one\n1. Cameras\n2. Powerbanks\n3. Smartphone cases"))
#Here we are choosing out of the 3 given options
if option == 1:
Cameras = input("Which do you think is better wide angle or telephoto Lenses?")
if Cameras == "wide angle" or Cameras == "telephoto Lenses" or Cameras == "Wide" or Cameras == "Telephoto" or Cameras == "wide" or Cameras == "telephoto":
print ("Please make sure you enter only one of the options")
used = input("They are both excellent lenses it really does depend on what you are going to be used for. which do you think are used in our mobile phones?")
input("Good try however did you know that our phone cameras are neither. They are actually made up of different layers of lenses \n what type of scenery do you enjoy?")
print ("what coincidence i enjoy the same thing! Now that we have spoken about different lenses. \n pick a location and i will inform you which lens you should use!")
option = int(input("\n 1. A Sun Set\n 2. Morain Lake\n 3. Maroon Bells\n 4. Santorini\n 5. Blue Ridge Mountain"))
if option == 5:
print("This mountain has spectacular views!, fantastic for capture on wide angle lenses")
if option == 4:
print("This is a beautiful island it actually best known for its romantic scenery, fantastic view to capture on wide angle lenses")
if option == 3:
print("This is one of my favorites as the mountains are shaped like bells. you could capture the scenery on a wide lens")
if option == 1 or option == 2:
print("Fantastic choice, in order to capture these beautiful scenery you can use the wide angle lense")
final = input("Thank you for your time, you may leave this chatbot by entering 'NO' however i have saved the best until last please enter yes to carry one")
if final == "No" or final == "no":
print("Thank you.")
exit()
if final == "Yes" or final == "yes" :
print ("Thank you.")
if option == 2:
powerbank = input("Did you know that powerbanks only can be used from 200 to 1000 times?")
if powerbank == "No" or powerbank == "no" or powerbank == "Yes" or powerbank =="yes" :
print("This is because power banks once overused are not be able to sustain a discharge current and therfore they can no longer holding any charge")
aesthetics = input("Powerbanks come in different colours, shapes , sizes and many external factors of different designs. Which one is your favourite?")
print ("Thats intresting mine is different i enjoy feel of the product it must be made of quality")
types = input("Did you know that there is also a mechanical powerbank available?")
if powerbank == "No" or powerbank == "no" or powerbank == "Yes" or powerbank =="yes" :
input("Yes it is really intresting actually it works like an alternator however in a smaller version \n How much would you pay for a powerbank?")
print ("you see i think it all depends on what you are getting the higher the mAh capacity the more you will have to pay")
yu = input ("You dont really have to only buy external powerbanks")
print ("yes, they are actually integrated battery cases.")
zu = input("Do you want to learn more about phone cases ?")
if zu == "No" or zu == "no" or zu == "Yes" or zu =="yes" :
print ("Sure not an issue")
final = input("Thank you for your time, you may leave this chatbot by entering 'NO' however i have saved the best until last please enter yes to carry one")
if final == "No" or final == "no":
print("Thank you.")
exit()
if final == "Yes" or "yes" :
print ("Thank you.")
if option == 3:
print ("Good choice lets proceed")
cases = input(" let's start off by proceeding to see some different types of smartphone cases, are you okay with this? ")
if 'no' in cases or 'No' in cases:
print("Thank you for your time")
exit()
if 'yes' in cases or 'Yes' in cases or 'yeah' in cases or 'okay' in cases :
#This is different way that i haev used to make python accept user inputs
if 'no' in cases or 'No' in cases:
print("Thank you for your time")
exit()
listOfCases = ["Armor Case" , "TPU Gel" , "Battery Case" , "Rubber Case" , "Leather Case"]
U = listOfCases
for U in listOfCases:
#Here i am using a while loop to print the above list that i have made
print (U)
fav = input("which is you favioute case? when picking please only enter the type of case ")
F = fav
print(F.lower())
#this will return the entered value so the user can see what they are doing
if fav == "Rubber " or "TPU" or "Leather " or "rubber " or "tpu" or "leather ":
print ("Excellent choice i can see you have gone for more of the classical orginal case.")
if fav== "Battery " or "Armor" or "battery " or "armor":
print ("Good choice, however i personally believe the extra expense is unessary unless esential to you")
likes = input("why do you think people are using smartphone cases?")
#left input answer blank - allowing user to enter anything
print("That could be one reason. However i believe the reason is most likely because technology is starting to become a lot more complex, with this comes more internal parts which may cause devices to become more delicate")
final = input("Thank you for your time, you may leave this chatbot by entering 'NO' however i have saved the best until last please enter yes to carry one")
if final == "No" or final == "no":
print("Thank you.")
exit()
if final == "Yes" or final == "yes" :
print ("Thank you.")
#after completing 3 options we on to the final part of the code this is the integrated API
#
print ("Thank you for your time we are now reaching the end of the chat. ")
import urllib.request, json
#Google MapsDdirections API endpoint
endpoint = 'https://maps.googleapis.com/maps/api/directions/json?'
api_key = 'AIzaSyDoPcva7jSfLdpDLcAwwKA23SA7WaGpQQk'
# Asks the user to input Where they are and where they want to go.
origin = input('What is your current destination?: ').replace(' ', '+')
destination = input('Please enter the city of where you want to go?: ').replace(' ', '+')
# Building the URL for the request
nav_request = 'origin={}&destination={}&key={}'.format(origin, destination, api_key)
request = endpoint + nav_request
# Sends the request and reads the response.
response = urllib.request.urlopen(request).read()
# Loads response as JSON
directions = json.loads(response)
print(directions)
print("I hope you have enjoyed yourself and learnt somthing new today, Thank you. Creator:Sandeep Beedh ")
exit()