Python phone questionnaire help-making more efficient


#1

i have to make a program that asks for users phone type, then it will ask them questions. after that it will ask them what is wrong with their phone, to which the program identifies key words in order to get a solution from text files. if there is no solution, the program creates a text file with a random case number with the users problem. my code is in 3 pieces:

Main

import sys
import random
def ending():
    print('Thank you for using our system.\nGood bye!')
    input('Press enter to end')
    sys.exit()
    

print('Welcome to the mobile phone troubleshooting service.')
name = input('What is your name?: ').title()
print('Hello',name,', you will now be asked to state the make of your phone.')
mobile_device = input('What phone make do you have?: ').lower()


if mobile_device == 'iphone':
    import iPhone
elif mobile_device == 'samsung':
    import Samsung

else:
    no = random.randint(10000,99999)
    case_number = (name + str(no))

    solutions = open(case_number+ '.txt','w+')
    solutions.write('Customers device: '+mobile_device+'\n')

    issue = input('What is your problem: ')
    solutions.write('customers problem  '+issue)

    solutions.close()
    print('Sorry, we are unable to help you with your issue at this moment in time, we will assign you a case number and a member of our support staff will contact you in the next 48 hours')
    ending()

Samsung

solution = open('Samsung_solutions.txt', 'r+')
solutions = solution.readlines()


print('Welcome to the mobile phone troubleshooting service for, Samsung')
print('You will now be asked to state what the problem wuth your device is.')

user= input('What is the issue with your phone ').lower()

#Tuple data type. when program is run, values cannot be changed
apps = ('apps are freezing' 'keep freezing', 'freezing', 'freeze')
if any(i in user for i in apps):
    print(solutions[4])
    

update = ('version', 'ios', 'updates', "can't update", 'not able to update', 'updating')
if any(i in user for i in update):
    print(solutions[5])
    

network = ('networks', 'signal', 'wifi', 'internet', "can't connect")
if any(i in user for i in network):
    print(solutions[6])


apps_2 = ('apps are crashing' 'keep crashing', 'crashing', 'crash')
if any(i in user for i in apps_2):
    print(solutions[2])
    
    
display = ('display', 'display is slow', 'running slow', 'slow', 'unresponsive', 'phone screen is slow', 'phone is slow')
if any(i in user for i in display):
    print(solutions[3])

screen = ('screen is cracked', 'cracked', 'screen broken', 'broken screen', 'cracked my screen', 'screen broke', 'broke my phone', 'screen')
if any(i in user for i in screen):
    print(solutions[10])

Charging = ('charger', "charger won't work", 'not charging', 'charge')
if any(i in user for i in display):
    print(solutions[11])

camera = ('my camera is blurry', 'camera', 'scratches', ' scratched', 'fuzzy', 'blurry')
if any(i in user for i in display):
    print(solutions[13])

microphone = ('microphone', "people can't hear me", "can't hear", "hard to understand", 'speak', 'voice' 'can hear' 'calls')
if any(i in user for i in microphone):
    print(solutions[12])

screen = ('getting hot', 'overheating','heating up' 'overheat', 'over heating')
if any(i in user for i in screen):
    print(solutions[9])

iphone

#task
solution = open('iPhone_solutions.txt', 'r+')
solutions = solution.readlines()


print('Welcome to the mobile phone troubleshooting service, for iPhone!.')
print('You will now be asked to state what the problem wuth your device is.')

user= input('What is the issue with your phone ').lower()

#Tuple data type. when program is run, values cannot be changed
apps = ('apps are freezing' 'keep freezing', 'freezing', 'freeze')
if any(i in user for i in apps):
    print(solutions[4])
    

update = ('version', 'ios', 'updates', "can't update", 'not able to update', 'updating')
if any(i in user for i in update):
    print(solutions[5])
    

network = ('networks', 'signal', 'wifi', 'internet', "can't connect")
if any(i in user for i in network):
    print(solutions[6])


apps_2 = ('apps are crashing' 'keep crashing', 'crashing', 'crash')
if any(i in user for i in apps_2):
    print(solutions[2])
    
    
display = ('display', 'display is slow', 'running slow', 'slow', 'unresponsive', 'phone screen is slow', 'phone is slow')
if any(i in user for i in display):
    print(solutions[3])

screen = ('screen is cracked', 'cracked', 'screen broken', 'broken screen', 'cracked my screen', 'screen broke', 'broke my phone', 'screen')
if any(i in user for i in screen):
    print(solutions[10])

Charging = ('charger', "charger won't work", 'not charging', 'charge')
if any(i in user for i in display):
    print(solutions[11])

camera = ('my camera is blurry', 'camera', 'scratches', ' scratched', 'fuzzy', 'blurry')
if any(i in user for i in display):
    print(solutions[13])

microphone = ('microphone', "people can't hear me", "can't hear", "hard to understand", 'speak', 'voice' 'can hear' 'calls')
if any(i in user for i in microphone):
    print(solutions[12])

screen = ('getting hot', 'overheating','heating up' 'overheat', 'over heating')
if any(i in user for i in screen):
    print(solutions[9])

i have 2 text files with the solutions for each phone in them. is there anyway i can make this more efficient? as i need it to be the most efficient it can be, even if i have to change the whole code.