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

this err

i type this i get this err SERVICE_CHARGE = 2 TICKET_PRICE = 10

tickets_reamining = 100

def calculate_price(number_of_tickits): return number_of_tickets * TICKET_PRICE * SERVICE_CHARGE

while tickets_reamining >= 1:
    print("there are {} tickets reamining.".format(tickets_reamining))
    name = input("whats your name ?  ")
    tickits_you_want = input("how many tickets you want {} ".format(name))
    try:
        tickets_you_want = int(tickets_you_want)
        if tickets_you_want > tickets_reamaning:
            raise ValueError("there are on an  x amount of tickets left try again man")
    except ValueError as err:
        print("oh no that doesnt make that much sence type something that makes sence..")
    else:    
        ammount_due = calculate_price(num_tickets)
        print("the total is {}".format(ammount_due))

        keep_going_man = input("do you wanna continue  ? y/n ")
        if should_prossed.lower() == "y":
            print("sold please come by again dear")
            tickets_remaining -= num_tickets
        else:
        print("try again")

treehouse:~/workspace$ python masterticket.py
File "masterticket.py", line 28
print("try again")
^
IndentationError: expected an indented block

2 Answers

The clue is in the error message (which you thankfully posted too).

IndentationError: expected an indented block.

When using a conditional like else, you need to indent anything that you want to run as part of that conditional statement.

So, for this instance, you need to indent the print("camelot") command 4 spaces.

I hope this helps you Shmuel

print("try again") must be indented to the right relative to else: (preferably by 4 characters). That is:

else:
    print("try again")