Python Python Basics All Together Now Handle Exceptions

FabianTafadzwa Shumba
FabianTafadzwa Shumba
1,454 Points

How do i rectify this error

TabError: inconsistent use of tabs and spaces in indentation

2 Answers

Josh Keenan
Josh Keenan
17,329 Points

you need to do ``` and then you put your code, delete it and repaste it inside them, I can't help you because I can't see where you have gone wrong with the indent, read the markdown guide to help

Josh Keenan
Josh Keenan
17,329 Points

This means you have misindented your code somewhere, remember indentation matters too, if you need help debugging the code feel free to post it here and I can help.

FabianTafadzwa Shumba
FabianTafadzwa Shumba
1,454 Points

Thank you.. I have pasted my code below:

TICKET_PRICE = 10

tickets_remaining = 100 while tickets_remaining >= 1: print("There are {} tickets remaining.".format(tickets_remaining)) name = input("What is your name? ") num_of_tickets = input("How many tickets would you like, {}? ".format(name)) try: num_of_tickets = int(num_of_tickets) if num_of_tickets > tickets_remaing: raise ValueError("There are only {} tickets reamining".format(tickets_remaining)

except ValueError as per err:
    print("Oh no, we have run into and issue. {}. Please try again".format(err)
else:     
    amount_due = num_of_tickets * TICKET_PRICE        
    print("The total due is ${}".format(amount_due) 
    prompt = input("Do you want to proceed?Y/N    ")    
    if prompt.lower() == "y":
        print("SOLD!!!")        
        tickets_remaining -= num_of_tickets
    else:
        print("Thank you anyways, {}!".format(name))

print("Sorry the tickets have all been sold out!!!! :(")

Josh Keenan
Josh Keenan
17,329 Points

Can you copy this ``` and paste it at the start and end of your code on another line, so it will format correctly.

your code here