Problem 48

Updated solution with list comprehensions.