Home > front end >  How do I stop an input when i entered a certain word?
How do I stop an input when i entered a certain word?

Time:10-19

I´m doing a small work for college and i need to stop a certain input when u entered a certain word in python?

I tried this but it isn´t working

  if (entrance == 'STOP'): 
      break;

CodePudding user response:

FIrst of all always provide the maximum information you can about your question. Secondly the brackets around the if conditional and the semi column are redundant in python.

For your problem, try using while loops to test the input of the user. Something like,

 while input() != 'STOP':
 # insert code here
  • Related