Avatar ·

How to check multiple values of a variable with the if operator?

📁 Advanced Python Topics, question, example, work, project

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

Suppose I need to create a program that only knows how to exit its 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  ( "enter the word 'output' to exit the program: ')   if  vyhod ==  'exit' :  exit( 0 )   if  vyhod ==  'exit' :  exit( 0 )