Count how many vowels and consonants occur in a string: Difference between revisions
Count how many vowels and consonants occur in a string (view source)
Revision as of 08:46, 22 December 2022
, 1 year agoAdd Plain English
Jazzedpineda (talk | contribs) (Added REBOL implementation) |
(Add Plain English) |
||
Line 1,700:
<pre>[vowels = 15,consontants = 30,rest = 9]</pre>
=={{header|Plain English}}==
<syntaxhighlight lang="plainenglish">To run:
Start up.
Put "Now is the time for all good men to come to the aid of their country." into a string.
Find a vowel count and a consonant count of the string.
Write the double-quote byte then the string then the double-quote byte on the console.
Write "Number of vowels: " then the vowel count on the console.
Write "Number of consonants: " then the consonant count on the console.
Wait for the escape key.
Shut down.
To find a vowel count and a consonant count of a string:
Slap a substring on the string.
Loop.
If the substring is blank, exit.
Put the substring's first's target into a letter.
If the letter is any vowel, bump the vowel count.
If the letter is any consonant, bump the consonant count.
Add 1 to the substring's first.
Repeat.</syntaxhighlight>
{{out}}
<pre>
"Now is the time for all good men to come to the aid of their country."
Number of vowels: 22
Number of consonants: 31
</pre>
=={{header|Python}}==
|