On 27/08/14 14:40, Jake wrote:
To whom it may concern, My name is Jake and I have recently started the GCSE computing course with school.
answera = input() if answera == ["Oslo" or "oslo"]:
This doesn't do what you think it does. ["Oslo" or "oslo"] is a list "Oslo" or "oslo" is the content of the list and is a boolean expression which evaluates to True. (Each non-empty string is considered True by Python) So your 'if' line looks to Python like: if answera == [True]: But answera is a string so it will never equal a list with a single boolean value so you go to the else clause. A better way to do what you want is to convert the input to lowercase using the string lower() method and compare that to the string you want, like so: if answera.lower() == "oslo": If you need to check multiple possible answers you can use a list of strings and the 'in' operator like this: if answera.lower() in ['amsterdam', 'london', 'oslo']: HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor