企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
表达式:运算符和操作数构成的序列 #### 条件判断if ~~~ age = 3 if age >= 18: print('your age is', age) print('adult') elif age <=10: print('your age is', age) print('teenager') else: print('your age is', age) print('teenager') ~~~ ### 循环for,用于遍历 ~~~ sum = 0 for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: sum = sum + x else: print('end') for x in range(0,10,1): print(x) ~~~ ### 循环while,用于递归 ~~~ sum = 0 while sum > 0: sum = sum + 1 else: print('end') ~~~