|
28 | 28 | ],
|
29 | 29 | "tags": ["python", "string", "palindrome", "utility"],
|
30 | 30 | "author": "dostonnabotov"
|
| 31 | + }, |
| 32 | + { |
| 33 | + "title": "Count Vowels", |
| 34 | + "description": "Counts the number of vowels in a string.", |
| 35 | + "code": [ |
| 36 | + "def count_vowels(s):", |
| 37 | + " vowels = 'aeiouAEIOU'", |
| 38 | + " return len([char for char in s if char in vowels])", |
| 39 | + "", |
| 40 | + "# Usage:", |
| 41 | + "print(count_vowels('hello')) # Output: 2" |
| 42 | + ], |
| 43 | + "tags": ["python", "string", "vowels", "count", "utility"], |
| 44 | + "author": "SteliosGee" |
| 45 | + }, |
| 46 | + { |
| 47 | + "title": "Check Anagram", |
| 48 | + "description": "Checks if two strings are anagrams of each other.", |
| 49 | + "code": [ |
| 50 | + "def is_anagram(s1, s2):", |
| 51 | + " return sorted(s1) == sorted(s2)", |
| 52 | + "", |
| 53 | + "# Usage:", |
| 54 | + "print(is_anagram('listen', 'silent')) # Output: True" |
| 55 | + ], |
| 56 | + "tags": ["python", "string", "anagram", "check", "utility"], |
| 57 | + "author": "SteliosGee" |
| 58 | + }, |
| 59 | + { |
| 60 | + "title": "Remove Punctuation", |
| 61 | + "description": "Removes punctuation from a string.", |
| 62 | + "code": [ |
| 63 | + "import string", |
| 64 | + "", |
| 65 | + "def remove_punctuation(s):", |
| 66 | + " return s.translate(str.maketrans('', '', string.punctuation))", |
| 67 | + "", |
| 68 | + "# Usage:", |
| 69 | + "print(remove_punctuation('Hello, World!')) # Output: 'Hello World'" |
| 70 | + ], |
| 71 | + "tags": ["python", "string", "punctuation", "remove", "utility"], |
| 72 | + "author": "SteliosGee" |
31 | 73 | }
|
32 | 74 | ]
|
33 | 75 | },
|
|
0 commit comments