Count how many vowels and consonants occur in a string: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: 33 "vowels and consonants")
Line 570: Line 570:
print(f'{nv + nc} "vowels and consonants"\n')
print(f'{nv + nc} "vowels and consonants"\n')


print(f'\t{nv} instances of {len(vs)} vowels:')
print(f'\t{nv} characters drawn from {len(vs)} vowels:')
print(showCharCounts(vs))
print(showCharCounts(vs))
print(f'\n\t{nc} instances of {len(cs)} consonants:')
print(f'\n\t{nc} characters drawn from {len(cs)} consonants:')
print(showCharCounts(vs))
print(showCharCounts(vs))


Line 639: Line 639:
<pre>33 "vowels and consonants"
<pre>33 "vowels and consonants"


12 instances of 5 vowels:
12 characters drawn from 5 vowels:
('a', 4)
('a', 4)
('e', 3)
('e', 3)
Line 646: Line 646:
('u', 1)
('u', 1)


21 instances of 9 consonants:
21 characters drawn from 9 consonants:
('a', 4)
('a', 4)
('e', 3)
('e', 3)