Python) If, else, elif

강현상
Jul 1, 2021

--

When the outcomes are different by different acts or different inputs, we use ‘if’ to set the right outcomes for each acting

example ‘if’

Also use it to distinguish particular numbers into different categories, such as odd or even.

example for the sentence on the top of this pic

‘If’ is necessary to use, but if there are different categories than two to distribute, you also can use ‘else’ and ‘elif’

example for the sentence on the top of this pic

After you use those three: ‘if, else, elif, you have to change the line and indent

Since Python can judge simple things in math, it automatically says true or false to something *example for simple judgment: python will say false for 3>2 <- this expression

--

--