python study notes three (if statement)

if statement
format:
** logic: ** When the program executes the statement if the first value calculation expression. If the "expression" is true, "statements" under the if is executed; if the "expression" is false, then skip the entire if statement, it goes on.
What is true and false?
False: 0 0.0 '' None False
True: In addition to false is true

if-else statement
Here Insert Picture Description
logic: When the program executes the if-else statement, the first calculated value "expression" if "expression" is true, execute "statement 1", executing the "statement 1" directly out the whole if-else statement. If the "expression" is false, then the implementation of "statement 2", the implementation of complete "statement 2" out of the whole if-else statement.

Guess you like

Origin blog.csdn.net/weixin_38324954/article/details/91437955