Complex Conditions | Python for Beginners [23 of 44]

preview_player
Показать описание


#microsoftdeveloper #pythonforbeginners #learntocode
Рекомендации по теме
Комментарии
Автор

I would like to rephrase the last part and possibly clarify for some people. [if honour_roll:] is only a shortcut for [if honour_roll == True:]. If you are checking for False then you can't use that shortcut you need to type the whole thing [if honour_roll == False:]. On the video it is worded a bit confusing.

EduardoSanchezCamacho
Автор

1/ Question: when evaluating an "AND", is it as with the "OR": the second condition will be evaluated after the first, and only if the first is TRUE ?


Therefore, we can spare calculation-intense tests if we put it in second postion


2/ Does this means also that this second condition may produce an error if it were to be evaluated on its own ... and the error is not raised as this second condition is not evaluated?

Skrattoune
Автор

In programming languages such as JavaScript or Python, if you declare a variable in a block scope (if statement, for statement, ...) the variable is hoisted to the outer function scope

donfeto
Автор

I don't think you ever said that True and False must be capitalized to work.

UnitOfE
Автор

In the case of the test "if variable in (condition1, condition2, condition3):"
is the test "if variable == condition1:" performed before condition2 and condition3 are even evaluated?

Skrattoune