Python 3.2 how to set correct and incorrect answer on questions inside 2 lists
<p>I am making 2 sets of question, first set (list1) is all yes and second (list2) is all no 10 questions each then I used random.choice to randomly pick a question from the 2 sets. I want to make an output of "correct" whenever random.choice picks a question from list 1 when the user answered "Y" same with list2 if the user answered "N". Here is my code:</p>

<pre><code>import random


Count = 0

list1 = ['1+1=2?','2+2=4?','3+3=6?','4+4=8?','5+5=10?','15+15=30?','16+16=32?','17+17=34?','18+18=36?','19+19=38?']
list2 = list2 = ['20+20=10?','6+6=2?','7+7=11?','8+8=32?','9+9=21?','10+10=0?','11+11=4?','12+12=12?','13+13=25?','14+14=13?']
list = list1 + list2

while(Count &lt; 5):
    print(random.choice(list))
    Answer = input("Answer: ").upper()
    Count = Count+1
    if(list == list1):
       if(Answer == "Y"):
          print("Correct")
       else:
          print("Incorrect")
    if(list == list2):
       if(Answer == "N"):
          print("Correct")
       else:
          print("Incorrect")
</code></pre>

<p>I cannot figure out how to output the correct and incorrect statement. Any help would be truly appreciated.</p>

<p>A more pythonic way would be:</p>

<pre><code>list1 = ['1 + 1 = 2? ', '2 + 2 = 4? ', '3 + 3 = 6? ', '4 + 4 = 8? ',
         '5 + 5 = 10? ', '15 + 15 = 30? ', '16 + 16 = 32? ', '17 + 17 = 34? ',
         '18 + 18 = 36? ', '19 + 19 = 38? ']
list2 = ['20 + 20 = 10? ', '6 + 6 = 2? ', '7 + 7 = 11? ', '8 + 8 = 32? ',
         '9 + 9 = 21? ', '10 + 10 = 0? ', '11 + 11 = 4? ', '12 + 12 = 12? ',
         '13 + 13 = 25? ', '14 + 14 = 13? ']

for _ in range(5):
    chosen_list = random.choice([list1, list2])
    chosen_question = random.choice(chosen_list)
    answer = raw_input(chosen_question).upper()
    if chosen_question in list1 and answer == 'Y':
        print('Correct')
    elif chosen_question in list2 and answer == 'N':
        print('Correct')
    else:
        print('Incorrect')
</code></pre>

python python-3.x