Skip to content

Commit d210bf6

Browse files
committed
Update consolidated snippets
1 parent 1124c4d commit d210bf6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

public/consolidated/all_snippets.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,66 @@
10271027
"utility"
10281028
],
10291029
"author": "dostonnabotov"
1030+
},
1031+
{
1032+
"title": "Count Vowels",
1033+
"description": "Counts the number of vowels in a string.",
1034+
"code": [
1035+
"def count_vowels(s):",
1036+
" vowels = 'aeiou'",
1037+
" return len([char for char in s.lower() if char in vowels])",
1038+
"",
1039+
"# Usage:",
1040+
"print(count_vowels('hello')) # Output: 2"
1041+
],
1042+
"tags": [
1043+
"python",
1044+
"string",
1045+
"vowels",
1046+
"count",
1047+
"utility"
1048+
],
1049+
"author": "SteliosGee"
1050+
},
1051+
{
1052+
"title": "Check Anagram",
1053+
"description": "Checks if two strings are anagrams of each other.",
1054+
"code": [
1055+
"def is_anagram(s1, s2):",
1056+
" return sorted(s1) == sorted(s2)",
1057+
"",
1058+
"# Usage:",
1059+
"print(is_anagram('listen', 'silent')) # Output: True"
1060+
],
1061+
"tags": [
1062+
"python",
1063+
"string",
1064+
"anagram",
1065+
"check",
1066+
"utility"
1067+
],
1068+
"author": "SteliosGee"
1069+
},
1070+
{
1071+
"title": "Remove Punctuation",
1072+
"description": "Removes punctuation from a string.",
1073+
"code": [
1074+
"import string",
1075+
"",
1076+
"def remove_punctuation(s):",
1077+
" return s.translate(str.maketrans('', '', string.punctuation))",
1078+
"",
1079+
"# Usage:",
1080+
"print(remove_punctuation('Hello, World!')) # Output: 'Hello World'"
1081+
],
1082+
"tags": [
1083+
"python",
1084+
"string",
1085+
"punctuation",
1086+
"remove",
1087+
"utility"
1088+
],
1089+
"author": "SteliosGee"
10301090
}
10311091
]
10321092
},

0 commit comments

Comments
 (0)