1

I am new to python and I have to code a ticket system. The user needs to answer a few questions and a ticket is create. The user should then later be able to view all tickets created or search the ticket by number. I can not figure out how to do this. Any one else have a few ideas?

Below is my current code:

class MenuList(object):
    menu_options = {
        0: 'Exit',
        1: 'Submit help desk ticket' ,
        2: 'Show all tickets',
        3: 'Search ticket by ticket number',
        4: 'Re-open resolved ticket',
        5: 'Display ticket stats'
    }
    print(menu_options)

class Ticket(object):

    datal = []
    def __init__(self, staffid, staffname, staffemail, issue):
         ticketnum = 2000
         self.staffid = staffid
         self.staffname = staffname
         self.staffemail = staffemail
         self.issue = issue
         self.status = 'open'
         self.answer = 'None'


         ticketlist = ("staff ID: " + staffid,
                      "staff name: " + staffname,
                      "staff email: " + staffemail,
                      "Description of issue: " + issue,
                      "Ticket status: " + self.status, "Ticket number: ", ticketnum, "Responds: " + self.answer )
         print (ticketlist)

option = int(input('Enter your choice: '))


def submit():
    staffname = input('Enter staff name: ')
    staffid = input('Enter staff ID: ')
    staffemail = input('Enter email address: ')
    issue = input('Description of issue: ')
    if issue == 'Password change':
        newpass = staffid[0:2] + staffname[0:3]
        print("Your new password is: " + newpass)
    ticketobject = Ticket(staffid, staffname, staffemail, issue)

    Newticket = input('Do you have another problem to submit? (Y/N)')
    if Newticket == 'Y':
        return submit()




if option == 1:
    submit()
else:
    print('Incorrect input. Please select from the list: ')
FlyGirll
  • 11
  • 1

1 Answers1

0

what you could do is create a while True or while 1 loop, the infinite loop will keep the program runing and you can use a bunch of if: statements inside, when you want to close the program just use break:

while 1:
    #print the options of valid inputs
    
    text = input()

    if text == "exit":
        break
Mrextremo1
  • 23
  • 6