网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

Python if...else 语句的用法

时间:2025-01-20 07:46:47

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 语句的用法
© 2025 小知经验
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com