Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics All Together Now Handle Exceptions

How do i rectify this error

TabError: inconsistent use of tabs and spaces in indentation

2 Answers

I have tried it.. Its not working

Josh Keenan
Josh Keenan
20,315 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
20,315 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.

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
20,315 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