## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# why does my if else statement not work?

why is

```confirm = input("do you want to proced? Y/N    ")
```

in a loop even if one these perameters are met?

```if confirm == "y":
print("SOLD!")
tickets_remaining -= number_of_tickets
elif confirm == "n":
sys.exit("thanks anyways {}!".format(name))
```

```import sys

TICKET_PRICE = 10

tickets_remaining = 100

print("there are {} tickets left".format(tickets_remaining))

name = input("what is your name?    ")

number_of_tickets = int(input("how much tickets would you like, {}?    ".format(name)))

amount_due = number_of_tickets * 10
print("that would be \${}, {}.".format(amount_due, name))

print("are you sure you want to go through with this?    ")

confirm = input("do you want to proced? Y/N    ")
while confirm.lower != ("y", "n"):
print("whoops! try again!")
confirm = input("do you want to proced? Y/N    ")

if confirm == "y":
print("SOLD!")
tickets_remaining -= number_of_tickets
elif confirm == "n":
sys.exit("thanks anyways {}!".format(name))
```
```

MOD

Hey Sabeen Azhar, there a a few problems with your `while` loop conditional

• `confirm.lower` is a bound method. Without specifying the () parens to call the function, this is a reference to the executable itself.
• comparing to a tuple `("y", "n")` will only match another tuple of the same values.

You can use the `in` operator to see if something is "in" a container of values, such as a tuple:

```while confirm.lower() not in ("y", "n"):
```

Post back if you need more help. Good luck!!

Thank you for the answer Chris Freeman, it worked perfectly!