pi=22/7
rad3 = float(input("Enter the radius of the circle: "))
print("\n")
float(print (4/3)* pi *rad3**3)
Im not sure what is wrong with my code
You are printing inside a float cast. That print(4/3)
returns a None value, which cannot obviously be multiplied with a float value (pi variable). Maybe you wanted to do print(float((4/3) * pi * rad3 ** 3))
?
Try this.
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.