Functions

Problem 1: Write a function called volume that takes one numerical input: w. It returns the volume of a cube with width w.

volume(1) -> 1
volume(3) -> 27

Problem 2: Write a function called area that takes two numerical inputs: h and w. It returns the area of a triangle with height h and width w.

area(3,2) -> 3
area(4,9) -> 18

Problem 3: Write a function called count_vowels that takes one string input: S. It returns the number of vowels that are in S.

count_vowels(‘hello world’) -> 3
count_vowels(‘aeiou’) -> 5
count_vowels(‘bcdfg’) -> 0

Problem 4: Write a function called sum that takes one list input: L. It returns the sum of all the numbers in L.
* The elements in L do not have to be numbers. If there are no numbers, then the function should return 0.

sum([1,2,3]) -> 6
sum([1,’2′,3]) -> 4
sum([‘1′,’2′,’3’]) -> 0