I’m VERY new to coding and I feel like I’m missing VERY basic things, so please bear with me. My professor has made it very clear that we have to use sys (a lot of the examples use sys.argv). I’m having the hardest time wrapping my brain around how it works. I was asked to create a function that counts the vowels in a phrase. This is the code I have come up with – How can I modify it to use sys? I hope this makes sense, and thank you in advance.
def count_vowels(string):
vowels = set('AEIOU')
count = 0
for character in string.upper():
if character in vowels:
count += 1
return count
count_vowels('This is a test run')
New contributor
Larissa Richey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.