dimanche 2 octobre 2016

Python 3.4 If and elif statements not working

So the problem I'm having is with this part of a simple script for a Chat Bot about Programming. But when I test this part of the script and type in 'B' as my input, it says ('Panda: I'm glad you share my enthusiasm.') which is what is mean't to happen if I input A! Can someone please point out to me what I'm doing wrong?

invalidAnswer2 = true
while invalidAnswer2 == true :
    answer2 = input (user)
if answer2 == ('a') or ('A') :
    print ('Panda: I'm glad you share my enthusiasm.')
    invalidAnswer2 = false
elif answer1 == ('b') or ('B') :
    print ('Panda: I wish. I am actually British, but I dream of going to America!')        
    print ('Panda: *Cough* Um anyway that was rather unproffesional of me.')
    invalidAnswer2 = false
else :
    invalidAnswer()
    invalidAnswer2 = true

Aucun commentaire:

Enregistrer un commentaire