## Challenges

Reddit challenges in python language.

Files Code and Result

### challenge193_easy

```''' An international shipping company is trying to figure out
how to manufacture various types of containers. Given a volume
they want to figure out the dimensions of various shapes that
would all hold the same volume.
Input:

A volume in cubic meters.
Output:

Dimensions of containers of various types that would hold the volume.
The following containers are possible.

Cube
Ball (Sphere)
Cylinder
Cone

Example Input:

27
Example Output:

Cube: 3.00m width, 3.00m, high, 3.00m tall
Cylinder: 3.00m tall, Diameter of 3.38m

Some Inputs to test.

27, 42, 1000, 2197
'''

import math

def cube(vol):
r = vol / 3
return r

def sphere(vol):
r = ((3 * vol) / (4 * math.pi)) ** (1 / 3)
r = round(r, 2)
return r

def cylinder(vol):
r = (vol / (math.pi * h)) ** 0.5
r = round(r, 2)
return r

def cone(vol):
r = (3 * (vol / (math.pi * h))) ** 0.5
r = round(r, 2)
return r

def display(volume, h):
print('A cube of {0} metres cubed will have sides of {1} metres'.format(volume, h))
print('A sphere of volume {0} cubic metres will have a radius of {1} metres.'.format(volume, sphere(volume)))
print('A cylinder of {0} cubic metres with a height of {1} will have a radius of {2} metres.'.format(volume, h, cylinder(volume)))
print('A cone of {0} cubic metres and height of {1} metres will have a radius of {2} metres'.format(volume, h, cone(volume)))

if __name__ == '__main__':

lst = [27, 42, 1000, 2197]
for num in lst:
h = round((num / 9), 2)
ans = display(num, h)
print(ans)
print()

# 193
```

### Result

```A cube of 27 metres cubed will have sides of 3.0 metres
A sphere of volume 27 cubic metres will have a radius of 1.86 metres.
A cylinder of 27 cubic metres with a height of 3.0 will have a radius of 1.69 metres.
A cone of 27 cubic metres and height of 3.0 metres will have a radius of 2.93 metres
None

A cube of 42 metres cubed will have sides of 4.67 metres
A sphere of volume 42 cubic metres will have a radius of 2.16 metres.
A cylinder of 42 cubic metres with a height of 4.67 will have a radius of 1.69 metres.
A cone of 42 cubic metres and height of 4.67 metres will have a radius of 2.93 metres
None

A cube of 1000 metres cubed will have sides of 111.11 metres
A sphere of volume 1000 cubic metres will have a radius of 6.2 metres.
A cylinder of 1000 cubic metres with a height of 111.11 will have a radius of 1.69 metres.
A cone of 1000 cubic metres and height of 111.11 metres will have a radius of 2.93 metres
None

A cube of 2197 metres cubed will have sides of 244.11 metres
A sphere of volume 2197 cubic metres will have a radius of 8.06 metres.
A cylinder of 2197 cubic metres with a height of 244.11 will have a radius of 1.69 metres.
A cone of 2197 cubic metres and height of 244.11 metres will have a radius of 2.93 metres
None

```