1) Using recursion, if given a word/phrase return how many vowels(a,e,i,o,u) are in that phrase or word:
Note: the function should be able to count how many vowels no matter if it is lowercase or uppercase .
Exercise: FizzBuzz
FizzBuzz is a common coding problem that asks you to print the numbers from 1 to 100. However, there are a couple of exceptions:
- For multiples of three, print "Fizz" instead of the number.
- For multiples of five, print "Buzz" instead of the number.
- For numbers which are multiples of both three and five, print "FizzBuzz".
Try to write a Python program that accomplishes this task using a function with a "for" loop. After you've completed that, try to write the same program but using a "while" loop instead.
Remember to test your code to ensure it's working as expected!
Hints:
- You can use the modulus operator
%
to check if a number is a multiple of another number. For example,n % 3 == 0
checks ifn
is a multiple of 3. - For the "for" loop, consider using the
range
function. - For the "while" loop, you'll need to manually increment your counter.