27?
1/3 of the cubes have volume 1, 1/3 have volume 27, and 1/3 have volume 125. The expected value of the volume is 51. Think about why it is 51, not 27, and you'll see why it is not 27 for the continuous case.
In general, if you have a random variable X, and some function of that random variable, f(X), then it is NOT true that expected value of f(X) = f(expected value of X).
from random import random
sum([(random()*4+1)**3 for x in xrange(1000000)])/1000000
=> ~39
Weird. sum(random.uniform(1, 5)**3 for i in range(10000)) / 10000
Many people don't know that the random module allows to sample from many distributions directly without having to construct your own.