Skip to main content
 首页 » 编程设计

python之python中的嵌套if else语句

2024年10月25日10shihaiming

<分区>

我想知道您是否可以执行以下操作:

if(condition): 
    if(condition: 
         if(condition): 
             print("some text") 
         else: 
             print("some more text") 
    else: 
         print("text") 
else: 
     print("Text") 

我的主要问题是,当我尝试运行多个嵌套的 if 语句时出现错误?

谢谢