在Python中使exponent'cubed'?

时间:2013-09-23 19:15:30

标签: python

如何在打印时使Python中的指数立方。

e.g。 print ("3***cubed***")

我不想将数字多维数据集 - 我想要符号

提前致谢

我想制作这个音量计算器:

我希望它在结束时打印出立方体,当它告诉你答案时:

height = input("Enter the height: ")
if int(height) <0:
    print("Please enter a number larger than 0")
    height = input("Enter the height: ")
if not int(height) < 2**31 - 1:
    print("You have not entered a number")
    height = input("Enter the height: ")
height = int(height)

width = input("Enter the width: ")
if int(height) <0:
    print("Please enter a number larger than 0")
    height = input("Enter the height: ")
if not int(height) < 2**31 - 1:
    print("You have not entered a number")
    height = input("Enter the height: ")
width = int(width)

length = input("Enter the length: ")
if int(length) <0:
    print("Please enter a number larger than 0")
    length = input("Enter the height: ")
if not int(length) < 2**31 - 1:
    print("You have not entered a number")
    length = input("Enter the length: ")
length = int(length)

volume = height*width*length

print ("The volume of the cuboid is" + str(volume) +"cm"

1 个答案:

答案 0 :(得分:1)

"make the exponent cubed"没有意义。如果你想“立方体”一个数字,这意味着你想把它提升到三次幂。换句话说,您希望指数为三。

>>> 2**3
8