# start of loop

# initialise loop so that it runs at least once
name = " "
count = 0
MAX_TICKETS = 5

while name != "xxx" and count < MAX_TICKETS:
    print("You have {} seats left ".format(MAX_TICKETS - count))

    # get details
    name = input("name: ")
    count += 1
    print()
    if name == "xxx":
        count -= 1


if count == MAX_TICKETS:
    print("You have sold all available tickets!")

else:
    print("You have sold {} tickets. There are still {} places available".format(count, MAX_TICKETS - count))
