Question: I'm trying to make this little game I found and for some reason when I type "Y" on "Would you like to pick an apple?" IT will stay at 1 no matter what I try. Here is my code:

```
import time
global choice
global gold
global apples
apples = 0
gold = 0

def begin():
    apples = 0
    gold = 0
    print ("Let's go!")
    if gold > 99:
        print ("You've won the game!")
        play = input ("Do you want to play again? Please answer Y/N.")
        if play == "Y":
            begin()
        if play == "N":
            print ("Okay, bye then.")
    pick = input ("Do you want to pick an apple Y/N?")
    if pick == "Y":
        print ("You pick an apple")
        apples=apples+1
        apples = 1
        print ("You currently have,",apples," apples")
        begin ()
    if pick == "N":
        sell = input("Do you want to sell your apples Y/N?")
        if sell ==  "Y":
            gold
            apples
            print ("You currently have,",apples,"apples")
            print("You have sold your apples")
            gold=apples*10
            print ("Your gold is now:",gold)
            begin()
            start()

print ("Hello and welcome!")
name = input("What's your name?")
print ("Welcome, "+name+"!")
print ("The goal of this game is to collect apples")
print ("After you have collected these applaes, you sell them.")
choice = input("Do you want to play? Type Y/N.")
if choice == "Y":
    begin()
if choice == "N":
    print ("Okay, bye then.")

```

If anyone could help me with this problem it would be highly appreciated. I am just a beginner so don't be too harsh. Sorry if this problem is obvious, I have only just started.

Answer: 
I think that for efficiency and maintainability you should either define a custom validator like explained [here](http://parsleyjs.org/doc/index.html#custom) or a regex one if you're good at it (`((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?(?=.*[#%@!*(()+=]))).{6,16}` could do the job?);)
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.6.0/parsley.js"></script>
<form data-parsley-validate>                             
<input type="password" name="password" id="password" minlength="6" data-parsley-type="alphanum" data-parsley-pattern="^/^[a-zA-Z0-9\-\_]$/" class="form-control allForms" required data-parsley-required-message="Your password" data-parsley-trigger="change focusin" placeholder="Enter password">
</form>
```