Cube root calculation

Post Reply
sairammohan
Posts: 1
Joined: Sun May 20, 2018 6:28 pm

Cube root calculation

Post by sairammohan » Wed May 23, 2018 4:15 am

Hi,

Here is my question:

Input Format :
Input consists of 2 integers which corresponds to the volume and the number of cargos, respectively.

Output Format :
Output consists of a single integer, which corresponds to the volume of the container.

Sample Input:
27
64
Sample Output:
1728


My Solution is:

a= input()
b = input()
s1 = int (a ** (1/3))
print (s1)
s2 = int (b ** (1/3))
print (s2)
print ((s1*s2) ** 3)


Am seeing this error:
Traceback (most recent call last):
File "C:\Working\Learnings\Python\Python Bible\pgm1.py", line 3, in <module>
s1 = int (a ** (1/3))
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'float'

Can any please help on this? Thanks in advance.

Post Reply

Return to “Python Language Elements”