Skip to content

Commit 1798d44

Browse files
Most Frequent Vowels and String
1 parent 9d7f685 commit 1798d44

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

Strings/Max_Volwes_String.ipynb

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "a3b404e9",
6+
"metadata": {},
7+
"source": [
8+
"# Most frequent Vowels and String"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 5,
14+
"id": "292f0948",
15+
"metadata": {},
16+
"outputs": [
17+
{
18+
"data": {
19+
"text/plain": [
20+
"6"
21+
]
22+
},
23+
"execution_count": 5,
24+
"metadata": {},
25+
"output_type": "execute_result"
26+
}
27+
],
28+
"source": [
29+
"from collections import Counter\n",
30+
"s = \"successes\"\n",
31+
"count = Counter(s)\n",
32+
"\n",
33+
"vowels = 'aieou'\n",
34+
"max_vowels = 0\n",
35+
"max_constant = 0\n",
36+
"for cnt in count:\n",
37+
" if cnt in vowels:\n",
38+
" max_vowels = max(max_vowels, count[cnt])\n",
39+
" else:\n",
40+
" max_constant = max(max_constant, count[cnt])\n",
41+
"\n",
42+
"max_vowels+max_constant"
43+
]
44+
}
45+
],
46+
"metadata": {
47+
"kernelspec": {
48+
"display_name": "Python 3",
49+
"language": "python",
50+
"name": "python3"
51+
},
52+
"language_info": {
53+
"codemirror_mode": {
54+
"name": "ipython",
55+
"version": 3
56+
},
57+
"file_extension": ".py",
58+
"mimetype": "text/x-python",
59+
"name": "python",
60+
"nbconvert_exporter": "python",
61+
"pygments_lexer": "ipython3",
62+
"version": "3.13.3"
63+
}
64+
},
65+
"nbformat": 4,
66+
"nbformat_minor": 5
67+
}

0 commit comments

Comments
 (0)