All pastes #3787469 Raw Edit

Peter Minns

public unlisted python v1 · immutable
#3787469 ·published 2017-03-29 00:53 UTC
rendered paste body
def aPrint ():                      #This function prints the list legibly    for i in aList:        print(i, end=" ")    print('\n')        user_request()     def aAdd (NewStr):                  #This function adds a new input to the queue    aList.append(NewStr)    user_request()    def aRemove (aList):                #This function removes the first input in the queue    newlist = []    for i in range(1,len(aList)):        newlist.append(aList[i])    aList = newlist    return (aList)    user_request()        def aLeave(aList,usrstr):           #This function lets the user choose an element     tempq = []                      #to remove from the queue    idx = 0    found = False    while idx < len(aList) and not found: #This section works out the index        if aList[idx] == usrstr:          # of the user string thats needs removed            found = True                  # from the queue list.        else:            idx = idx + 1    if found:                for i in range(len(aList)):       #This sections takes the index previously             if i == idx:                  #found and uses it to create a new list                continue                  #without the element the user has requested to be removed            tempq.append(aList[i])    return (tempq)    user_request()    def aLocation():                    #This function prints the memmory location of the queue    print ("The list is located at memory location",(id(aList)))    user_request()def aQuit():                        #This function will quit the program    exit()    def user_request():                 #This function loops to keep asking the user what to do    order = input("What would you like to do P | A | N | L | M | Q \n")    while True:        if order == 'P':            aPrint()        elif order == 'A':            useradd = input("what would you like to add to the queue?")            aAdd(useradd)        elif order == 'N':            aList = (aRemove(aList))        elif order == 'L':            aList = (aLeave(aList,input("What would you like to remove from the queue?")))        elif order == 'M':            aLocation()        elif order == 'Q':            aQuit()    aList = []user_request()