Write a Python program to implement queue using a list data-structure.

def enqueue(rear,number,queue,front):
   rear=rear+1
   queue.append(number)
   return rear
 
def dequeue(front,queue,rear):
   if (front==rear):
      print('queue empty')
      return front
   front=0
   print('item removed is ',queue[front])
   queue.remove(queue[front])
   rear=rear-1
   return rear
  
# main program /starting point
queue=[]
front=-1
rear=-1
choice=0
while(choice!=4):
    print('press 1:queue 2:dequeue 3:show list 4:exit')
    choice=int(input())
    if(choice==1):
       number=int(input('enter the number to enqueue'))
       rear=enqueue(rear,number,queue,front)
    elif(choice==2):
       rear=dequeue(front,queue,rear)
    elif(choice==3):
       print('now the queue is')
       size=len(queue)
       if size>0:
          print('front->',queue,end=' ')
          Print('<-back')
       else:
          print('empty')
 
Explanation: in this program we have to implement queue data structure using list. Queue works on the system of FIFO(first in first out). element that enters the queue first will come out first. so we are assuming a back index pointer from where item is added in the list. A front index pointer that will point to first index position always and item is  removed from this position.
 
We are taking user choice in integer form to do the required operation. we are doing it with While loop. choice 1 is calling enqueue function, where we are incrementing rear index pointer to next location in the queue(list).item is added using append function of list. append function adds item to the last of the list.
 
choice 2 is calling dequeue function, where item is always removed from front(0) index pointer position. item is removed using remove function of list. choice 3 is the logic to show the queue. If user presses 4 then program terminates.
 
** if front==rear means rear index position is also pointing to index 0, it means queue is empty**