## 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. # I don't get why you put attempt_count += 1 inside the if block. Isn't this equal to 2?

import sys

print("Welcome to secret town")

Hello Angel,

It is difficult to read your code because of the formatting. Please read the Markdown Cheatsheet to learn how to show your code in forum posts. It is below the "Add an Answer" area  The statement "`attempt_count += 1`" will increase the value in "attempt_count" by one. So if it begins as 1, the first time this statement is encountered, it will change to 2. But the next time it will become 3, and then 4, as the loop continues to repeat. Why is it that I get 4 attempts when I write the code this way:

```import sys

attempt_count = 1

if attempt_count > 3:
attempt_count += 1

print("Welcome to secret town")
```

It will let you get up to 4 wrong answers, but if I write like this:

```import sys

attempt_count = 1

attempt_count += 1
if attempt_count > 3:
```

It gives me 3 attempts.

I reversed the attempt_count += 1 The difference is the first example tests to see if the value is more than 3 before it changes it; But in the second example it changes it first, and then tests to see if it is more than 3.

So because of the order, the first example repeats one more time than the second one. If this code were to go first:

```    if attempt_count > 3:
```

The value for attempt_count can instantly reach 4 attempts by the user and be greater than 3.

However, if this code were to go first:

```    attempt_count += 1
```

The value for attempt_count would be the number of attempts by the user, which would max out at 3 because adding 1 will make it 4. Then it follows with the if attempt_count > 3: code.

Thanks, Steven Yes, you are correct. "Instantly" was not the proper wording. The code will repeat until the number of attempts is greater than 3.

attempt_count += 1 would execute after an attempt, at some point prior to this section of code you would have attempt_count = 0 most likely. So attempt_count += 1 would set it to 1 the first time it is triggered, 2 the second time and so on. Why is it that I get 4 attempts when I write the code this way:

```import sys

attempt_count = 1

if attempt_count > 3:
attempt_count += 1

print("Welcome to secret town")
```

It will let you get up to 4 wrong answers, but if I write like this:

```import sys