logo

Python 条件语句

在这里介绍Python条件语句!

Python条件语句是通过一条或多条语句的执行结果(True或者False)来决定执行的代码块。

Python 编程中 if 语句用于控制程序的执行,基本形式为:

                 
                  if 判断条件:
                    执行语句……
                  else:
                    执行语句……
                
              

举例:

                     
                        good_weather = True

                        if good_weather:
                            print("我很好")
                        else:
                            print("我不好")