This works fine for me:
while True:
   answer = input('Do you want to continue?:')
   if answer.lower().startswith("y"):
      print("ok, carry on then")
   elif answer.lower().startswith("n"):
      print("ok, sayonnara")
      exit()
edit: use input in python 3.2 instead of raw_input
Hope it helps!!
If you need to know more about Python, It's recommended to join Python course today.
Thanks!