本站资源收集于互联网,不提供软件存储服务,每天免费更新优质的软件以及学习资源!

Python

网络教程 app 1℃

Python

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 is5.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 – 级别:询问的详细内容,更多请关注范的资源库其它相关文章!

转载请注明:范的资源库 » Python

喜欢 (0)