mercredi 20 avril 2016

How do I make my program differentiate between two different pathways?

So basically I have this program that matches separate words from the user's problem regarding phones to the ones that are stored in a list. Once all of the words have been scanned some might have been matched and a number of solutions may be given regarding the different problems that the user has:

while **num  == len(words)**:
    if words[num] in storage:
        keyword = storage.index(words[num])
        while not "{" in storage[keyword]:
            keyword+=1
        answer = storage[keyword].replace("{", "")
        print (answer)
        num+=1
    elif **num==len(words)**:
        print("Thank you for using this troubleshooting process and we hope that we have solved your problem.")
        break
    else:
        num+=1
        continue
print("No solution has been found to your problem. Please rephrase your sentence and try running this troubleshooting system again. Thank you.")

As seen above if none of the words are matched, the program would tell the user that no solution has been found. However, if all the words are scanned and some of them do match, how can you distinguish between the two as they both have the same code?

Aucun commentaire:

Enregistrer un commentaire