аватар question@mail.ru · 01.01.1970 03:00

How to check a few values ​​of the variable operator if?

Hello! I work on a large project. But I will explain my question on a different example ...

Suppose I need to create a program that only knows how to get out of his temper)

but the user can write “output”, “output”, “Vyhod”, “Exit”, “Exit” or “DS [jl” ”(on the layout. 'Latin'), etc.

Then the code would look something like this

  vyhod =  input  ()   if  vyhod == :  expt ( 0 )   if  vyhod == :  expit ( 0 )   if  vyhod ==  '`` `` `` `Span>:  Exit ( 0 )     

and so on ...

So, how can this be reduced. For example, I tried to do it like:

   if> vyhod == , , :  exit ( 0 ) r  

and so

  if  vyhod == ; ; :  exit (
                            
                            
                        
аватар answer@mail.ru · 01.01.1970 03:00

You can like this:

   IF  vyhod  in  [, , ]:  explode ( 0 )  

but better, better, better, better Bring the line to the lower register and check only 1:

  un  vyhod.Lower () ==  "" Exit "" :  exit ( 0 )                                       

Latest

Similar