Python is saying that a variable has not been asigned when it has
Question: 
    import random
    import time
    name=input("Wecome to the game what is your name")
    print(("This is a numbers game"),(name),("you will be playing against the computer."))
    print("The idea of the game is to get closer to 21 to the computer without going over 21"),
    ready="N"
    ready=input("Are you ready to play the game yet?").lower
    if ready=="yes" or ready=="y":
        score=0
        while (score)<21 and (ready == "Y" or ready == "Yes" or ready =="YES" or ready == "yes" or ready =="y"):
            player1=random.randint(1,21)
            score=(score+player1)
            time.sleep(3)
            print(("you have scored"),(score))
            if score <21:
                ready=input("Do you want to add more to your score?")
    if score>21: *THE PROBLEMS ON THIS LINE HERE*
        print("Sorry Over 21 , The Computer Wins!")
    else:
        print("ok Well done let us see what the computer can do with their turn")
        computerscore=0
        while(computerscore)<21 and (computerscore)<(score):
            computer=random.randint(1,21)
            computerscore=(computerscore+computer)
            time.sleep(3)
            print(("The computer has scored"),(computerscore))
            if (computerscore)<=21 and (computerscore)>(score):
                print("Sorry the computer wins")
            else:
                print("You win well done")
            break
    

I get an error that says if score>21: NameError: name 'score' is not defined

but I have put score=0 so isn't that defining it?


Answer: I am guessing you are inputting the value `yes` correctly, the issue may be
because of the line -

    
    
    ready=input("Are you ready to play the game yet?").lower
    

You are assigning the reference to the `lower` function in `ready` , instead
you should call `lower()` and assign the return value in `ready` . Example -

    
    
    ready=input("Are you ready to play the game yet?").lower()
    

* * *

Also, if you want your code to work, when you do not input `ready` as `yes` ,
you should set `score=0` , before the `if` condition - `if ready=="yes" or
ready=="y":`

