samedi 1 avril 2017

assigning a case number as an if else elif statement

If the user inputs no when the program asks if the problem matches the one displayed by the system, the data should be allocated a case number and stored to be sent to a technician. I tried using the elif However the case number appears when i run the program not when the user replies no to the question.

def question():
  description = input('Please describe the problem with your device: ')
  words = {''.join(filter(str.isalpha, word))
             for word in description.lower().split()}
  for problem, keywords, steps in PROBLEMS:
    if words & keywords:
      print('This may be what you are experiencing:')
      print(problem)
      if get_response:
        print('Does this match your problem? ')
      ans=input()
      if ans== "yes":
        print('Please follow the solution given')
        print('After this, your problem should be solved.')
        print('If it does not, please take it to a professional.')
        break
      elif ans=="no":
        case_number()

import random       
def case_number():
  import random
case_number = random.randint(1, 10000)
print('Your case number is:')
print(case_number)

help will be appreciated!!!




Aucun commentaire:

Enregistrer un commentaire