Python if...else 语句的用法

2025-05-11 21:17:03

1、1Python if...else 语句的用法

Python if...else 语句的用法

2、2#程序解读:输入一个数字,如果小于10,输出平方值,如果大于10输出立方值

Python if...else 语句的用法

3、3ts1 = int(input("输入一个数字: "))#提示

Python if...else 语句的用法

4、4如果小于10,输出平方值if ts1<10:#如果小于10,输出平方值 dis1 = ts1**2 print ("平方值",dis1)

Python if...else 语句的用法

5、else:#如果大于10输出立方值 dis1 = ts1**3 print ("立方值",dis1)

Python if...else 语句的用法

6、输入一个数字,如果小于10,输出平方值,如果大于10输出立方值

Python if...else 语句的用法
Python if...else 语句的用法
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢