TypeError: '>' not supported between instances of 'function' and 'int'
Your ticket
variable gets overwritten by your function variable, ticket
. Which makes you get an error meaning you can't compare oranges(functions) to apples(integers). Rename either one and it should work fine.
Either replace:
global ticketticket = decimal.Decimal(random.randrange(0, 100))
with:
global anything_but_ticketanything_but_ticket = decimal.Decimal(random.randrange(0, 100))
or:
def ticket():
with:
def anything_but_ticket():