{"id":16529,"date":"2021-08-12T09:37:41","date_gmt":"2021-08-12T04:07:41","guid":{"rendered":"https:\/\/python-programs.com\/?p=16529"},"modified":"2021-11-22T18:38:25","modified_gmt":"2021-11-22T13:08:25","slug":"python-program-to-count-the-number-of-alphabets-in-a-string","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-count-the-number-of-alphabets-in-a-string\/","title":{"rendered":"Python Program to Count the Number of Alphabets in a String"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Count the Number of Null elements in a List<\/a>.<\/p>\n

Given a string, the task is to count the Number of Alphabets in a given String.<\/p>\n

isalpha() Method<\/strong>:<\/h4>\n

The isalpha() method is a built-in method for string-type objects. If all of the characters are alphabets from a to z, the isalpha() method returns true otherwise, it returns False.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given String = hello btechgeeks<\/pre>\n

Output:<\/strong><\/p>\n

The Number of Characters in a given string { hello btechgeeks } =  15<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given String = good morning btechgeeks<\/pre>\n

Output:<\/strong><\/p>\n

The Number of Characters in a given string { good morning btechgeeks } =  21<\/pre>\n

Program to Count the Number of Alphabets in a String<\/h2>\n

Below are the ways to Count the Number of Alphabets in a String.<\/p>\n