1
DIF=0

while DIF != 'Y' or 'N':
    DIF=raw_input('Do you want the cheese? Y / N ')

how can I makes this work? I need the answer to be either Y or N

I want to ask a question and the answer must be Y or N otherwise you can't continue.

if there is a better way of doing this please tell me.

Stefano Sanfilippo
  • 32,265
  • 7
  • 79
  • 80
GerhardAA
  • 61
  • 2
  • 8
  • Welcome to SO! Please edit your question to indicate what is specifically currently happening with your code that isn't working. (I can figure it out from looking at your code, but this is a key component of a good SO question). – Derek Feb 01 '14 at 14:48

1 Answers1

2

Use

while DIF != 'Y' and DIF != 'N':

instead, or better yet:

while DIF not in ('Y', 'N'):

Also, I would recommend you to follow Python naming conventions

Christian Tapia
  • 33,620
  • 7
  • 56
  • 73