-
Notifications
You must be signed in to change notification settings - Fork 0
Exercise 1 python. #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| def num_vowels(text): | ||
| """Return the number of vowels in string.""" | ||
| vowels = "aeiou" | ||
| vowels = "aeiouy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y is both a consonant and value, so the definition of vowel should be clarified
| num += text.lower().count(v) | ||
| return num | ||
|
|
||
| def num_consonants(text): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstrings could be added to describe what the function is doing
| for letter in text: | ||
| if letter not in vowels: | ||
| print("consonant", letter) | ||
| num += text.lower().count(letter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about numbers? I don't think numbers should be counted as consonants, but they were counted when I tested the script
jarbesfeld
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some requests
Description
Added some comments explaining the code.
Fixed the consonant printing.
Improved the message that is printed out.
Tested with the following strings:
Fixes issue
Fixes #7 python