7 kyu
Find the vowels
373 of 18,937willjharmer
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Why y is considered as vowel ???
why is 'y' a vowel....
why not? In some countries it is, in others it ain't
@KUN7DM, when you used the word
why
in your comment, the lettery
was being used as a vowel. In English, the reality is that most of the timey
is used as a vowel, although most English speakers do not actually know this.Most of the time it is not used as a vowel. It is only a vowel in words such as 'why', but in words such as 'yes' it is not. An acceptable solution to the Kata allows the letter y to be classified as a vowel in both cases, which is incorrect. In order for the Kata to be correct, it needs to be reclassified as being significantly harder as it would need to consider the structure of words for common patterns of where y is a vowel and not a consonant. Or, remove yas a vowel and stick with the commonly agreed a, e, i, o and u.
"commonly agreed" must be something i am not English enough to understand. In my language, Y is always a vowel.
Is it really that bad to treat Y as a vowel in this task if it is so clearly and explicitly specified? Would removal of Y help anyone in any other way than now they would not have to read the description carefully?
Why Y is vowel?
you just used it as one
No random tests in Haskell
Wrong description!
It is actually still the indices, it's just that it's 1-based indexing instead of 0-based.
I agree with you though, it should be clearer - like at least mention that it's 1-based.
Read the last note:
Why do you say it should be clearer when it is already there? Not a kata issue.
You're right ! Somehow I saw the first note but not the last one...
This comment has been hidden.
Please specify the language when raising issues. I'm assuming you're referring to the C translation.
No, the size of the allocated buffer is irrelevant as long as it's big enough. What's important is to set the value of
nb_vowels
appropriately (refer to the solution setup).Not a kata issue. Next time, please raise a
Question
when you're unsure.Sorry, I didn't know that the discussion is lanugage agnostic.
I see. I apologize.
just Y ? :((
Yes.
in English, Y is usually a vowel anyway, like the three out of four times you see it in this comment
I think the Kata owner should give a hint that the letter "Y" is also considered a vowel...
It's already there.
My bad, I have to start reading until the end
It's the second consecutive day that in every kata realized, there is always a random test messing around with all the test business logic(even without any documentation). These need to disapper, or create documentation for these random tests. PS: and I didn't talked about the "y vowel error"(which off course, it's a consoant) ERROR ALERT =RED FLAG
I just solved the kata in C# with no errors and discvered no messy business with the random tests.
Y is a special consideration because it is sometimes a vowel, which is a truth about the English language. You even employed it as such in your post, as have I in mine.
funny kata, since when was "y" a vowel :(
From the first paragraph of the Wikipedia article about
Y
(emphasis mine):literally right there in the first word of your comment
Y is a vowel? :(
Yes. No. It depends. In many languages it is, and, what's most important, description explicitly, clearly specifies that it is.
I shall join the horde here and complain that Y IS NOT A VOWEL AND INDEX != POSITION anyway nice one have a good day
In English, Y is almost always a vowel, in fact, rarely is it used as a consonant. This was quite a surprise when I made this discovery...
I hope your day
10 months ago
was good and I hope this turns out to also be a good day for you and everyone else.This is simply incorrect. It is sometimes a vowel, and mostly a consonant. If you ask any english speaker to list the vowels, they are not going to say aeiouy. That's because it is an exception to the rule, and saying it is almost always a vowel is the most pedantic take you could possibly have.
I hypy yyyr dyy
5 mynths ygy
wys gyd ynd I hypy thys tyrns yyt ty ylsy by y gyd dyy fyr yy ynd yvyryyny ylsy.How do you know?
Are we speaking english here? What do you mean how do I know it's sometimes a vowel and mostly a consonant? I'm english back to the damn romans invading britain, I barely speak a second language because I decided to learn german as a hobby. I might not be an english student, but I'm reasonably familiar with english as a language and the usage of letters. For example, in countdown: https://www.youtube.com/watch?v=qOYv1qicEcc - Ignoring the 7 million to 1 odds of her spelling her name, note the Y comes from the consonants?
The evidence undelying your assertion is lacking.
reasonably familiar
with english as a languageWhile your English credentials and provided reference are surely impeccable, what classifies Y alternately as a vowel and a consonant here is likely not a matter of English or game shows, rather a matter of phonology (i.e. how the sound is produced in your mouth). Basically, consonants show significant restriction of airflow by the tongue while vowels allow for free flowing airflow. In this light, classifying Y as a consonant could be seen as a bit dubious, since it generally is either a vowel or a semi-vowel.
Small sample, but just for fun...
Counts from your quote:
Y as vowel = 3
Y as consonant (semi-vowel) = 1
Y as letter = 1
Hilarious response actually, top kek. Still utterly redundant in real life ofc, but this is one of those things which people would pull out as a "do you know" fact for sure. I still reject this formal definition of a vowel, since I still stand by the simple statement that y is not mostly a vowel. Kids are not taught aeiouy, it's aeiou and sometimes y. Unless you're welsh. And by that logic, I still complain that we should not be making kata with y defined as a vowel.
I provided not just a game show tile, but THE origin of english culture and the FORMAL definition of vowels and consonants for at least two generations of british inbreeds such as myself. This revisionist definition based on phonology will not stand the test of countdown. The kata should be changed, and I have not changed my opinion on that. The hordes of complaints will only continue to rise mark my words.
Meanwhile you just proved that
y
can be a vowel by yourY
use count there. You just done the opposite of rising mark of your words.You still wanna stand on your perspective, that's fine. Let's just accept that both have some valid point and should stop debating about this. Different people comes from different cultures.
In french,
Y
is a vowel. Meanwhile based on what you said, english mostly doesn't consider it as one. Maybe the author comes from french or countries that have similar opinion aboutY
being a vowel? We never know. Codewars is not only for english users after all.I can guarantee you that every Polish person gets utterly confused when Y is not considered a vowel in a kata. For such user, Y is a vowel, always, period.
I also dont understand what exactly is the problem here. Y being a vowel or not is ambiguous and not well defined in general. Task clearly, unambiguously specifies this, comforming to one of possible, well known interpretations. What is the problem then?
No, we must argue about this irrelevance until the end of time itself. Y is never a vowel. You're all wrong.
Just kidding, it might not have come across overly well but I did actually read that comment counting the number of "y-vowels". It's annoyingly correct ofc, if you think about the phonology then yes Y is technically a vowel in many english words.
That doesn't mean I have to accept the technical correctness of it all, and certainly in the context of "What are the vowels in english?" If you said Y then most people will just laugh at you. And my comment saying that people will continue to complain is just an extension of that. I'm not wrong am I? English/Americans are gonna be here going "why is y a vowel" until either the kata changes or the author goes nuclear and decides to define every letter as a vowel or something. It's just a bit weird, all in all.
Trying to not look through the keyhole of one specific language, a serious, honest question: out of all distinct languages which recognize the letter Y, how many of them considers it as a vowel, how many as a consonant, and how many as "it depends"? Has anyone any idea here?
@196alex, you've crossed an over zealous English teacher, so you've found yourself on the business end of a pedant bomb. Hunker down...
I'm not sure you should lump Americans into this group... I've never had any qualms thinking of Y as a vowel, and actually have a harder time seeing it as a consonant. Probably because, even using the structural definition (i.e where the Y falls in a word), most occurences in English are categorized as vowels (I'm unaware of a definition which extends beyond mere assertion that has most English occurences of Y being categorized as a consonant).
However, let's be honest, nobody cares about that dross... It's come down to a battle of whose schoolhouse rote will win the day. So, don't give up, and fight to the death we shall! Arbitrary definitions must be defended!
Incredible thank you. Ultimately this is just ignorance of english on full display, but it's also true that we simply are not taught y as a vowel, so it's hard to shake that ingrained knowledge.
Which is quite odd, why is y simply put in the consonant box? Why is this potentially a regional thing within england, if there are actually english teachers aware of this? Why is english in general so... English?
Well, that's a problem for the linguists and english students. I'm either going to become "that guy" and start asking people to list all the vowels to say ACTUALLY, or I'll double down to spite the welsh specifically (despite quite liking wales).
I'm doubling down. You yanks will never understand the rich culture that you abandoned, and we're never going forgive the loss of all that tea. To arms!
Valiant you may be, but I'm afaid your cause is lost as I have destiny on my side seeing as it can be no coincidence that VICTORYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY!!! is spelled with a vowel Y
You can have fate on your side, but I have just stumbled upon this conclusive proof that Y is in fact a consonant: https://www.codewars.com/kata/5a19226646d843de9000007d
Read it and weep, fellow Y consonant users have coalesced and produced this brilliant counter kata. I have also decided that the solution to this issue is for me to avoid all suspicious usage of Y as a "vowel" henceforth. I think you will find this response adequate in this regard, and I'm quite enjoying being forced to re-evaluate the words I use. Yet, a single perfect tear leaves its mark upon mine face as I see how beautiful the english language can be without this fake vowel. Perhaps this issue should be taken to a higher judicial level, and all Y vowel words must be purged from our lexicons. I shall not miss them.
You may well have found good evidence backing your claim, but I categorically refuse to look at anything that could potentially start to undermine my irrational beliefs. Instead, I will retreat further into my shell by only recognizing Y as either a vowel or semi-vowel. The concept of Y as a consonant be banished!
Call me obstinate, call me an ideologue, call me an obstinate ideologue, or call me a twat. You probably wouldn't be too far off with any of these characterizations, but one thing is for sure, you Y-Consonanters have had your day!
I was helping one of my boys with this question (job interview prep). It took me 30 minutes to figure out why he was failing...
'Y' is not vowel!!!
glad you finally figured out why
Perhaps you should state up front, "We want to know the 'ordinal position' of the vowels in a given word" rather than its "index position." Because asking for the "index position," and not expecting the index position is just poor wording for instructions...
Some explanation of *nb_vowels? its passed to the function with no explanation of what it is.
nb_vowels
is the number of vowels. You need to report the number of vowels into it.It's an array of a single character which holds the amount of vowels.
For some reason.
God knows why they didn't just give a variable but you know, it doesn't matter.
Y is vowel!?
It's a vowel in this kata since it's explicitly stated in the description. And please don't argue about whether it is or not a vowel, this Discussion is full of people doing it and they have been shown many times that, yes, y can be arbitrarily considered a vowel, or not. And really it doesn't matter, it's a convention.
why not just start at index 0. WHY
It doesn't really matter, just add a '+ 1' to the index.
Yea but who goes out of their way to start indexing at 1 when everyone and their mother starts at zero.
Sample Tests for all languages should contain at least one instance of a word where
Y
is used as a vowel. Or for overkill, use a sentence like: "Why cry, shy gypsy nymph spy?" or maybe "Dry fry my wry myrrh cysts."Included for COBOL in this fork: https://www.codewars.com/kumite/61dd14e63d9294002708da2b?sel=62567ac3db6115006361818c
y is not a vowel
It is.
why
C translation (author gone)
Approved :)
COBOL translation (author inactive).
approved
Good challenge but 'y' is not a vowel !
Sometimes it is, as in 'by' or 'why'.
Y is NOT a vowel...?
What is then?
In English Y is a consonant
reallY? whY?
This comment has been hidden.
Y is not a vowel! At least, not in English
Why?
Why is Y not a vowel? Because it is a consonent!
depends on the language. It's a vowel in latin-like ones.
https://www.merriam-webster.com/words-at-play/why-y-is-sometimes-a-vowel-usage#:~:text=Y%20is%20considered%20to%20be%20a%20vowel%20if%E2%80%A6&text=When%20y%20forms%20a%20diphthong,yard%2C%20lawyer%2C%20or%20beyond.
From that article:
yes. in case of dipthong. but the problem never mentioned that. otherwise we had to consider strings ending with "oy", "ay", "ey" and not "iy" or "uy".
The description does mention that where it states:
Vowels in this context refers to: a e i o u y (including upper case)
. EDIT: regardless, if you can add to or modify the description to make this more clear for future coders, we are open to any additions or modifications that you may have to offer.yes. that's what i was saying. i know that the kata description had vowels referring to "aeiouy". As far as coding is concerned its perfectly fine. I'll modify the description so that there's not much confusion for others. thank you
It may be that y was listed as a vowel for no other reason than to trip up people who don't read the requirements carefully. I do not admit to being one of them.
That's a good one. a valuable lesson indeed. but yeah, like i mentioned previously, there wasn't anything wrong programatically. It's just an icky feeling when i read it initially. But when i looked it up on wikipedia, i was surprised to see the result. Modern english actually considers y as a vowel.
Yup. Since when, in what world was 'Y' a vowel? lol
in Polish. Since, well... always?
Try, fly by my wry rhythm gym.
lol.. yea, I was wondering the same thing! haha. oh well, I just added 'y' to my list of "vowels" to satisfy this kata
"y" is not a vowel, at least in portuguese is not
i know something is wrong with my solution but just i couldn't it, it is like the uppercase test is not passing that's all
The kata considers 'y' as a vowel, but this is neither explicitly stated in the kata description nor presented in the tests testable by the user. The author could
1.add the assumtion in the kata description
and2.add some sample tests that would not pass if y is not considered.
Pretty clearly stated there.
exactly!!
Nice "read all of the description" kata
finally kata considering 'y' a vowel
PHP translation, ready to be evaluated
Passed: 4 Failed: 0
but I got:
Traceback (most recent call last): File "main.py", line 2, in import codewars_test as test ModuleNotFoundError: No module named 'codewars_test'
C++ fork
Approved.
C++ tests generate warnings.
Fixed.
failed on the word 'bialy': [2, 3] should equal [2, 3, 5]...............how is this possible...y is not vowel
depends on the mother tongue of the author, often. In France, it is a vowel, for example...
ok.....done!!!
Python - Needs random tests
added
I suggest changing the index to start from 0 instead of 1. I didn't catch the note and it threw me off a bit. Just a suggestion =)
Nobody's going to change the requirements after 5k solutions.
Oh I didn't know that would be a problem. Sorry I'm a beginner at this
As 'Y' is only rarely considered a vowel, it really shouldn't be included. Easy enough to work around, but just a failure in the conceptualization of this kata. Just because you put y as a vowel in the instructions doesn't subvert the rules of language, so please stop using that excuse and just fix your kata.
only, rarely, really, easy...
This comment has been hidden.
It is clearly stated that
"y"
is a vowel in terms of this kata.I keep getting this error "EOFError: EOF when reading a line" in the window BUT when I run code in terminal or notebooks it works fine. Testing "super" gives [2, 4] as the expected result along with the other sample tests. The vowels "aeiouy" were considered and instructions were read.
EOF error means that you're most probably missing a parenthesis somewhere.
Code works in Terminal or notebook and I only get the error in CodeWars
Code works in Terminal or notebook and I only get the error in CodeWars
This is never an argument. Cases like yours always end up being a mistake on user's side.
Not arguing. I am wondering why it's an issue that's all. There were also some issues with the CodeWars Servers.
It would be easier for all if you post your code using proper markdown and marking your post as having spoiler content.
Because if your code is returning the wrong result, your code's returning the wrong result. Almost no languages changes behaviour very significantly for the same language version just because the runner environments is configured differently (there are some edge cases, but it's usually very hard to stumble on them accidentally), and especially, not Python. Blaming everyone else for your mistake is very likely to be wrong, and you'll end up making yourself look bad after ;-)
A E I O U Y? i didnt even read the instructions when completing the task as I know english language vowels are A E I O U - please correct this as otherwise this kata is incorrrect - it made me lol though when i finally read the instructions and realised why my tests were failing :-)
Reading the instructions is the first thing you should do before writing any code.
Consider case should be in the description.
added
How do we fix the problem when there are 2 of the same vowels, and so .indexOf would always return the index of the first vowel it finds even though we returned that one already. Example: [a, a] would be [1, 1] but we want [1, 2]
The same issue happened to me. Turns out you need to use the function "enumerate" in your for loop. Here is what helped me in this kata: https://www.codecademy.com/en/forum_questions/5087f2d786a27b02000041a9
Good luck :)
@Pink Ghost, rrogerthat used javascript, not Python.
4 weeks after it's like looking at the question for the 1st time again
The letter y is not a vowel in the English language. There are ony five vowels, a, e, i, o and u.
myth
https://en.oxforddictionaries.com/definition/vowel
Counterexample: https://en.oxforddictionaries.com/explore/is-the-letter-y-a-vowel-or-a-consonant But there is a note in the instructions that specify which letters you should find.
The link cited as a counterexample ends ".... Y tends traditionally to be counted among the consonants."
Fair enough, the list of characters were given. But it was just after describing them as "English Language Vowels". Given the other people moaning about it, I don't seem to have been the only one to just glance at the characters without noticing the 'y' at the end.
I don't think it would actually hurt anything to make the description clearer. "English language vowels and y". Or even "English language vowels including y" if y's vowel status is a point the author feels strongly about :)
[1,3,6] why??????
Crystal translation still waiting :)
JS and Crystal translation kumited :)
This kata doesn't make sense. The instructions say:
'''We want to know the index of the vowels in a given word, for example, there are two vowels in the word super (the second and fourth letters).
So given a string "super", we should return a list of [2, 4]. '''
index numbers begin at 0 in lists, the vowels in 'super' would be at 1 and 3
If we want to know the order in the list as opposed to index number the instructions on the kata should be amended to reflect this.
when there are foot notes in a kata, take care to read them carefully...:
the last note said that this is indexed from [1..n] (not zero indexed!)
"Y" is sometimes a vowel (e.g. in "smelly") sometimes not (e.g. in "yes"). It is wrong to simply treat it as a vowel.
And in french it's always a vowel... So, a clear rule is given, just apply it. ;)
Came here to say the same thing.
C++ translation added. https://www.codewars.com/kumite/593a5d2d942a276ae500001a
Up. :)
approved
thanks
This comment has been hidden.
Welcome to Codewars!
You're meant to
return
the result, notprint
it. Returning a value allows it to be checked for equality, whilst printing it just outputs the value locally to the console. "None" is the default value when nothing is returned.All Katas on this website work like this.
Next time can you mark your answer as a spoiler please - it's a box you can tick. Also, I suggest using 3 backticks (`) to display your code, as to show indentation properly - read more here
def vowel_indices(word): s = word.lower() return vowel = [ i+1 for i in range(len(s)) if s[i] in 'aeiouy']
Could someone tell me why this version got me syntax error while the enumerate method works?Thanks.
You can't declare a variable whilst returning the value. Both versions (with enumerate and without enumerate) work fully.
Would someone translate this kata to C# or JS?
Done :)
Tests all pass everywhere, but somethings going on with the clojure tests across codewars, they never count as passed
I forgot "Y"
It should be made clear in the description what letters are supposed to count as vowles.
THe description states pretty clearly the letters that are considered vowels...
**NOTE: Vowels in this context refers to English Language Vowels - a e i o u y ** ...
You're right. Obviously I didn't read the details properly...
No probs, a few people have missed it. So maybe I should put it before the main chunk of text, so it isn't missed.
Should be clear that "y" is also a vowel, its not in most other languages.
Hi Caspar,
At the end of the Kata description there was 'Vowels in this context refers to English Language Vowels - a e i o u y'. You may not have read that far. Can make it more prominent if necessary.
Vowels should be indicated clearly.
Cheers, have now indicated the vowels in the kata description.
Nice kata. It might be a good idea to include the list of acceptable vowels in the kata description, as other languages have different vowels (Welsh has 'w', Serbo-Croatian has 'r' etc).
This comment has been hidden.
I was taught the same but I learnt something new, the letter Y can be regarded as both a vowel and a consonant. So I opted for vowel in this kata. See wikipedia and http://www.oxforddictionaries.com/words/is-the-letter-y-a-vowel-or-a-consonant for detail.
It's more that describing a letter as being a vowel or consonant is fundamentally misleading. Those are types of sounds, and letters are not sounds - they're lines on paper or symbols on a screen. One letter can represent several sounds (as is the case with English 'y'), and sometimes multiple letters represent one sound - e.g. the word "hitch" has two consonants; they are written 'h' and 'tch'.
I don't know whether
y
belongs to vowels... If it does, just ignore my offence...Okey... I have just seen the discuss before...
Y in a vowel, please see to it being identified as such. Other than that? nothing wrong with this
Cheers, Y has been added and tests updated as such.
This is incorrect. Y is not a vowel in English.
In my opinion (backed by Wikipedia https://en.wikipedia.org/wiki/Vowel#Written_vowels) there are 6 vowels in latin alphabet. Namely: a, e, i, o, u, y.
In Haskell test fixture there are some test cases containing the letter y ("bialy"), but the assert says the vowel indexes are [2,3], whereas they should in fact be [2,3,5]. In other words letters 'y' and 'Y' should be considered vowels by the test fixtures, but they are not. But it might be some linguistic confusion from my side :-)
You're right, my bad, 'y' has been added and the tests updated as such
Add some random cases and I could approve your kata:-)
Neat little kata, but has major problem in the Python unit tests, as they do not compile!
Third line of the given Python unit test shoud read:
Rather than:
Thanks, had refactored my python submission tests without doing the same to initial tests. Apologies. Fixed now.
The initial solution in Clojure contains
(ns vowelIndices)
while the tests expect(ns vowelIndices.core)
. Namespaces and functions are usually named-like-this (vovel-indices.core
).Brill, thanks. Bit new to clojure so haven't covered naming conventions yet. I've updated the kata with your corrections.
Function name is still camelCase.
finally fixed! ;)
Python:
Test.describe("dbl_linear")
RLY?This comment has been hidden.
Absolutely! Thanks, I've added more and better test cases to cover the letter casing.
A good kata but needs mores tests: extreme cases, challenging and random tests.