Skip to content

Conversation

@github-actions
Copy link

Description

Added some comments explaining the code.

Fixed the consonant printing.

Improved the message that is printed out.

Tested with the following strings:

abcdefghijklmnopqrstuvwxyz
Welcome to the Jungle 1234

Fixes issue

Fixes #9 python

Copy link
Owner

@sabrinacamp2 sabrinacamp2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.

I didn't see the comments you mentioned or the print statement that you mentioned in the summary, is this all the commits you wanted to add?

def num_vowels(text):
"""Return the number of vowels in string."""
vowels = "aeiou"
vowels = "aeiouy"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend defining the vowels outside of the num_vowels() and num_consonants() functions since you are defining this twice (DRY principle). Also, I'm curious, is "y" considered a vowel?

num = 0
for letter in text:
if letter not in vowels:
print("consonant", letter)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be mistaken, but do you still want something printed out when the function is called?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python: Exercise 1

3 participants