In this practice HW you will create 2 programs that use strings, lists, and recursion.
Rx: <30 min Av: 30-60 min Sd: 60-90 min DNF: 90+ min
Write an iterative function count_vowels
which takes a word as a parameter and returns the number of vowels in that string.
Write a recursive function sajak
which takes a word as a parameter and returns the number of vowels in that string.
Test both functions by asking the user to enter a word, and printing the number of vowels found by each function.
Recommended Development Steps:
in
)count_vowels
function.sajak
function, think about how you can recursively print the first or last letter in a string, and implement it.Write a function pyramid
that takes a string of text as a parameter and outputs the text as follows:
Enter text: we love CS
w
we
we
we l
we lo
we lov
we love
we love
we love C
we love CS
we love C
we love
we love
we lov
we lo
we l
we
we
w
You may use either recursion or iteration in your solution. Note: if you use recursion, will need to implement 2 functions: one for printing top triangle of letters and one that prints the bottom triangle of letters. If using iteration, you will need 2 loops.
Test your functions by getting a string of text from the user and printing the results of both functions.
Recommended Development Steps:
:
)Once you’re satisfied that your programs are working correctly, take a screenshot of each program open in the editor, with its output displayed in the console, and submit to google classroom. You should submit 2 screenshots.