python and statement
Question: 
    import random
    
    def main():
        number = random.randint(0,100)
        print(number)
        guess = int(input("Enter your guess: "))
    
        if guess == number :
            print("You win $10,000!")
    
        elif guess // 10 == number // 10 or guess % 10 == number % 10 :
            print("You win 1,000$!")
    
        elif guess // 10 == number // 10 and guess % 10 == number % 10 :
            print("You win $3,000!")
    
        else :
            print("You win $0.")
    
    main()
    

This program works except for the `and` statement. Does anyone know why?


Answer: The reason is `or` covers `and`. Use `!=` which gives exclusive or, aka xor.

    
    
    import random
    def main():
        number = random.randint(0,100)
        print(number)
        guess = int(input("Enter your guess: "))
    
        if guess == number :
            print("You win $10,000!")
    
        elif (guess // 10 == number // 10) != (guess % 10 == number % 10) :
            print("You win 1,000$!")
    
        elif guess // 10 == number // 10 and guess % 10 == number % 10 :
            print("You win $3,000!")
    
        else :
            print("You win $0.")
    
    
    
    
    main()
    

