I am quite new to Python and I need to code something, but I am not really sure how to make it. I have few ideas, but I don't really know how to write the syntax.
The problem is as it follows:
You have a Python function getRandomLetter that returns a random letter of the alphabet. Call the function two times - count the number those calls that result in a vowel to see if you get two vowels in a row. Repeat THAT process 100,000 times and count the number of times two vowels were selected in a row.
HINT: Use the in operator to determine if a character is in a string:
If getRandomLetter() in 'AEIOU':
Well I thought of this for the start:
>>> import random >>> import string >>> def getRandomLetter(): random.choice(string.ascii_letters) >>> for i in range(2): getRandomLetter() #I should compare the two letters and see if both are vowels. I thought of something like this. if getRandomLetter in 'AEIOU': x=x+1 #x being the number of times I need to call the program until it gives me two consecutive vowels >>> for i in range(100000): getRandomLetter() #Here I need to see how many consecutive vowels there are after 100000 calls. if getRandomLetter() in 'AEIOU': y=y+1 #y being the number of consecutive vowels there are and in the end it should show the total of them after the 100000 calls.
The problem is that I don't really know how to see if there are two vowels in a row and how many of these 2 consecutive vowels there are after I call the program 100,000 times.
As I said, I have the ideas, but I don't really know how to write the syntax.
Thanks in advance.