繁体   English   中英

计算球体的体积

[英]Calculating Volume of sphere

pi=22/7
rad3 = float(input("Enter the radius of the circle: "))
print("\n")
float(print (4/3)* pi *rad3**3)

我不确定我的代码有什么问题

您正在浮动演员表中打印。 print(4/3)返回一个 None 值,该值显然不能与浮点值(pi 变量)相乘。 也许你想做print(float((4/3) * pi * rad3 ** 3))

尝试这个。

pi=22/7
rad = float(input("Enter the radius of the circle: "))
print("\n")
V= 4.0/3.0*pi*rad**3
print ("Volume is", V)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM