
1 级任务
1) 华氏度到摄氏度转换
f=int(input("enter the no. "))c=5/9*(f-32)print("fahrenheit to celsius",round(c))
输出:
enter the no. 108fahrenheit to celsius 42
2) 摄氏度到华氏度转换
c=int(input("enter the no. "))f=c*(9/5)+32print("celsius to fahrenheit",round(f))
输出:
enter the no. 42celsius to fahrenheit 108
3) 英尺到米的转换
#1 feet = 0.3048 metersfeet=float(input("enter the no. "))meter=feet*0.3048print("feet to meters",round(meter,1))
输出:
enter the no. 15feet to meters 4.6
4) 正方形的输入侧、输出区域
side=float(input("enter the no. "))area=side**2print("area of a square is ",area)
输出:
enter the no. 5area of a square is 25.0
5) 输入-长、宽;输出-矩形面积
#area of a rectangle=length*breadthlength=float(input("enter length of the rectangle. "))breadth=float(input("enter breadth of the rectangle. "))area=length*breadthprint("area of a rectangle is ",area)
输出:
enter length of the rectangle. 5enter breadth of the rectangle. 10area of a rectangle is 50.0
6) 半径 – 圆的面积
#area of circle = πr2r=int(input("enter the radius of circle: "))area=3.14*(r**2)print("area of the circle is ",area)
输出:
enter the radius of circle: 5area of the circle is 78.5
7) 美元 转换为 inr
#usd=rs. 84.56dollar=float(input("enter currency in dollars: "))usd=dollar*84.56print("currency in rupees is =",usd)
输出:
Enter currency in dollars: 500Currency in rupees is = 42280.0
以上就是Python – 级别:询问的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1354505.html
微信扫一扫
支付宝扫一扫