Am 02.05.2015 um 09:58 schrieb Alan Gauld:
I made no mention of green because it is not a tuple.
Can you see why 'in' is not the right test for green. Can you see
why the interpreter is complaining?


*This is what I programmed:*

number = int(input('Enter a number between 0 and 36: '))
green_numbers = (0)

Additional hint: It's the comma that makes a tuple, not the parentheses. So (0) is no tuple, (0,) would be one.

red_numbers = (1, 3, 5, 7, 9, 12, 14, 16, 18, 19,\
              21, 23, 25, 27, 30, 32, 34, 36)
black_numbers = (2, 4, 6, 8, 10, 11, 13, 15, 17, 20,\
                22, 24, 26, 28, 34, 29, 31, 33, 35)

if number in green_numbers:
    print('Number is Green')

elif number in red_numbers:
    print('Number is Red')

elif number in black_numbers:
        print('Number is Black')





_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to