Equals not being equals
Question: Can't get python quiz program to work, when the 'useranswer' is
'correctanswer' if loop doesn't work properly and states they aren't equal
even when they are. I'm wondering if this is a problem with comparing strings
saved in lists, but I am really stuck for what to do to fix it. Any help would
be much appreciated.

Thank you

    
    
    import sys
    
    print ("Game started")
    questions = ["What does RAD stand for?",
                "Why is RAD faster than other development methods?",
                "Name one of the 3 requirements for a user friendly system",
                "What is an efficient design?",
                "What is the definition of a validation method?"]
    
    
    answers = ["A - Random Applications Development, B - Recently Available Diskspace, C - Rapid Applications Development",
                "A - Prototyping is faster than creating a finished product, B - Through the use of CASE tools, C - As end user evaluates before the dev team",
                "A - Efficient design, B - Intonated design, C - Aesthetic design",
                "A - One which makes best use of available facilities, B - One which allows the user to input data accurately, C - One which the end user is comfortable with",
                "A - A rejection of data which occurs because input breaks predetermined criteria, B - A double entry of data to ensure it is accurate, C - An adaption to cope with a change external to the system"]
    
    correctanswers = ["C", "B", "A", "A", "A"]
    score = 0
    lives = 4
    z = 0
    
    for i in range(len(questions)):
        if lives > 0:
            print (questions[z])
            print (answers[z])
            useranswer = (input("Please enter the correct answer's letter here: "))
            correctanswer = correctanswers[z]
            if (useranswer) is (correctanswer):     //line im guessing the problem occurs on
                print("Correct, well done!")
                score = score + 1
            else:
                print("Incorrect, sorry. The correct answer was;  " + correctanswer)
                lives = lives - 1
                print("You have, " + str(lives) + " lives remaining")
            z = z + 1
        else:
            print("End of game, no lives remaining")
            sys.exit()
    
    print("Well done, you scored" + int(score) + "//" + int(len(questions)))
    


Answer: You should use `==` for comparison:

    
    
    if useranswer == correctanswer: 
    

`is` operator does _identity comparison_. And `==`, `>`, operators do _value
comparison_ , and that is what you need.

* * *

For two objects, `obj1` and `obj2`:

    
    
    obj1 is obj2  iff id(obj1) == id(obj2)  # iff means `if and only if`.
    

