At the start of my code it asks the user about their phone/phone model. Later on in the code, in an if statement, I am trying to make it so if a certain phone was entered by the user, it would trigger a certain solution and if it was anything else, another solution would be printed. This is my code:
import sys
import time
import webbrowser
print("Welcome to a sub-branch of Kareem Technological Cash & Carry Industries Ltd. ")
time.sleep(0.5)
print ("Ok, first let us determine the make of your phone ")
phone = input("What is the make of your Phone?\n ")
if phone == "Samsung" or phone == "samsung":
model1 = input("Now can you tell me the model of your phone, only enter the number of your model\n ")
if int(model1)<4:
print ("This model and any older models are not compatible with this system, sorry for any inconvenience!")
else:
print ("Let us move on.")
time.sleep(0.5)
elif phone == "Apple" or phone == "apple":
model2 = input("Now can you tell me the model of your phone, only enter the number of the model\n")
if int(model2)<4:
print("This model and any older models are not compatible with this system, sorry for any inconvenience!")
sys.exit()
else:
print("Let us move on.")
time.sleep(0.5)
issue = input("I assume you have called due to some sort of damage/issue with your phone, so can you give me some brief details on the damage done to your phone - ")
water = ['water', 'puddle', 'bath',' wet',' toilet']
phone = ['dropped', 'floor', 'smashed']
screen = ['display','LCD','digitizer','inteferrence']
system = ['buggy', 'unresponsive','crashes','laggy',]
battery = ['short life', 'overheats', 'overheat', 'hot','battery','overheating',]
t = ['hi']
solution1 = ("First try putting your phone in a bowl of rice overnight and see if that works, if not you should send it to you phone manufacturer.")
solution2 = ("You will most likely have to get your screen replaced, which you can do at any local phone shop. If this is not an option for you, just take it to you phones manufacturer and they will be able to sort it out.")
solution3 = ("You will have to replace whatever is causing the problem, send your phone to your phones manufacturer or take it to a phone shop.")
solution4 = ("Try doing a full system re-boot, if this does not work you should take it your phone's manufacturer.")
solution5 = ("Buy a new battery for you phone, this should fix the problem.")
solution6 = ("example6")
more = ("The details you have given us have not provided sufficient detail, please tell us more")
if any(word in issue for word in water):
print (solution1)
elif any(word in issue for word in phone):
print (solution2)
elif any(word in issue for word in screen):
if phone == "Apple" or phone == "apple":
print ("Use this link to help you out",webbrowser.open('http://ift.tt/2gRA9LV'))
else:
print(solution3)
elif any(word in issue for word in system):
print (solution4)
elif any(word in issue for word in battery):
print (solution5)
elif any(word in issue for word in t):
print (solution6)
else:
print (more)
(The issue is after the solutions are listed) Also any improvements on the efficiency/corrections of my code would help out as well, thank you.
Aucun commentaire:
Enregistrer un commentaire