🌐
W3Schools
w3schools.com › python › ref_string_isalpha.asp
Python String isalpha() Method
Remove List Duplicates Reverse ... Python Certificate Python Training ... The isalpha() method returns True if all the characters are alphabet letters (a-z)....
🌐
Python documentation
docs.python.org › 3 › library › stdtypes.html
Built-in Types — Python 3.14.4 documentation
For example: >>> 'Letters and spaces'.isalpha() False >>> 'LettersOnly'.isalpha() True >>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too True · See Unicode Properties. ... Return True if the string is empty or all characters in the string are ASCII, False otherwise.
🌐
Tutorialspoint
tutorialspoint.com › python › string_isalpha.htm
Python String isalpha() Method
Are all the characters of the string alphabetic? True · Only the lowercase and uppercase alphabets come under alphabetic characters. Even an empty space " " is not considered as alphabetic. str = "welcome " result=str.isalpha() print("Are all the characters of the string alphabetic?", result)
🌐
Linux Hint
linuxhint.com › python_isalpha_function
How to Use the Python Isalpha Function – Linux Hint
The for loop is used here to read each character of the mystr, while the isalpha() function is used to check whether or not the character is alphabetic. #!/usr/bin/env python3 # Input string data mystr = input("Enter your email address: \n") # Initialize the character counter char_counter = ...
🌐
Programiz
programiz.com › python-programming › methods › string › isalpha
Python String isalpha()
The isalpha() method returns True if all characters in the string are alphabets. If not, it returns False.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-string-isalpha-method
Python String isalpha() Method - GeeksforGeeks
October 3, 2025 - Return Type: Returns True if all characters in string are alphabetic (A-Z, a-z) and False otherwise. ... Explanation: Since s contains a space which is not an alphabetic character, so isalpha() returns False.
🌐
Codecademy
codecademy.com › docs › python › strings › .isalpha()
Python | Strings | .isalpha() | Codecademy
October 9, 2023 - The .isalpha() string method checks if all of the characters in a string are letters of the alphabet (a-z). The letters can be lowercase or uppercase. If the string only contains letters of the alphabet it returns True, otherwise it returns False.
🌐
Noble Desktop
nobledesktop.com › isalpha method in python
Isalpha Method in Python - Free Video Tutorial and Guide
June 5, 2025 - Now, what we could do in this case is also very popular exercise—we could count how many letters and how many numbers do we have in the string. So, how are we going to do it? First thing first, we need to grab each letter or let me say each character and apply this to each character. So, how are we going to do it? We need to use a for loop. Let me call this char in the word. And again, when you program, do not rush—go baby steps. Let's see print Char—let's see what Char is. Apparently, Char is each character right. So, now what we could do is actually apply isalpha() and now you see we're getting through false.
🌐
Csuk
coder.csuk.io › coder_course_page › advanced-string-methods-isalpha-isdigit-islower-isupper
Advanced String Methods (isalpha, isdigit, islower, isupper) – CSUK:Coder
If we check whether the entire string is alphabetic using .isalpha(), it will return False because of the numbers ("123"). Similarly, .isdigit() will return False because of the letters. Instead, we need to look at each character individually and check whether there are any letters, digits, ...
Find elsewhere
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › str › isalpha.html
isalpha — Python Reference (The Right Way) 0.1 documentation
For 8-bit strings, this method is locale-dependent. Returns False if string is empty. >>> ''.isalpha() False >>> 'abc123'.isalpha() False >>> 'abc'.isalpha() True >>> '123'.isalpha() False >>> 'Abc'.isalpha() True >>> '!@#'.isalpha() False >>> ' '.isalpha() False >>> 'ABC'.isalpha() True
🌐
Python Tutorial
pythontutorial.net › home › python string methods › python string isalpha()
Python String isalpha(): Check if all Characters in a String are Alphabetic
December 29, 2020 - In this tutorial, you'll learn how to use the Python string isalpha() method to check if all characters in a string are alphabetic.
🌐
Tutorial Gateway
tutorialgateway.org › python-isalpha
Python isalpha Function
March 2, 2026 - If you want, you can use the longer version of the above code to remove the non-alphabetical characters from a given string. str = 'Tuto@#rial123' al = '' for c in str: if c. isalpha(): al = al + c print(al) We can also use the isalpha() function filter the list items and display only the elements having alphabetical characters. In the following example, we declared a list of letters, numbers, combination of special character elements. Next, the for loop iterates over the list items.
🌐
Stack Overflow
stackoverflow.com › questions › 61594765 › how-to-use-str-isalpha
python - How to use str.isalpha()? - Stack Overflow
As you can understand, a strings variable value can never be equal to a Boolean value, thus the while loop never ends. You need an if else, not a while. if name.isalpha() != False: print( "Not in alphabets") else: print("In alphabets")
🌐
Stanford
web.stanford.edu › class › archive › cs › cs106a › cs106a.1204 › handouts › lecture-10.html
String Functions
Given a string s, return True if there is a digit in the string somewhere, False otherwise. Solution - same pattern as first_alpha(), but returns boolean instead of a char · for i in range(len(s)): if s[i].isdigit(): # 1. Exit immediately if found return True # 2. If we get here, # there was ...
Top answer
1 of 3
1

It seems you are expecting word[:-1] to remove the last character of word and have that change reflected in the list word_list. However, you have assigned the string in word_list to a new variable called word and therefore the change won't be reflected in the list itself.

A simple fix would be to create a new list and append values into that. Note that your original string is called input which shadows the builtin input() function which is not a good idea:

input_string = 'Hello, Goodbye hello hello! bye byebye hello?'
word_list = input_string.split()
new = []
for word in word_list:
    if word.isalpha() == False:
        new.append(word[:-1])
    else:
        new.append(word)

di = dict()
for word in new:
    di[word] = di.get(word,0)+1

print(di)
# {'byebye': 1, 'bye': 1, 'Hello': 1, 'Goodbye': 1, 'hello': 3}

You could also remove the second for loop and use collections.Counter instead:

from collections import Counter
print(Counter(new))
2 of 3
1

You are nearly there with your for loop. The main stumbling block seems to be that word[:-1] on its own does nothing, you need to store that data somewhere. For example, by appending to a list.

You also need to specify what happens to strings which don't need modifying. I'm also not sure what purpose the dictionary serves.

So here's your for loop re-written:

mystring = 'Hello, Goodbye hello hello! bye byebye hello?'
word_list = mystring.split()

res = []
for word in word_list:
    if not word.isalpha():
        res.append(word[:-1])
    else:
        res.append(word)

mystring_out = ' '.join(res)  # 'Hello Goodbye hello hello bye byebye hello'

The idiomatic way to write the above is via feeding a list comprehension to str.join:

mystring_out = ' '.join([word[:-1] if not word.isalpha() else word \
                         for word in mystring.split()])

It goes without saying that this assumes word.isalpha() returns False due to an unwanted character at the end of a string, and that this is the only scenario you want to consider for special characters.

🌐
Jobtensor
jobtensor.com › Tutorial › Python › en › String-Methods-isalpha
Python String isalpha(), Definition, Syntax, Parameters, Examples | jobtensor
myStr = "Boeing" result = myStr.isalpha() print(result) # another example myStr = "Boeing747" result = myStr.isalpha() print(result) Previous isalnum() Next isdecimal() Python Tutorial · What is Python? What do you use Python for? What can you do with Python? Why use Python? Hello World! Variables and Data Types · Lists · Basic Operators · Strings · Control Flows · For Loops ·
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.Series.str.isalpha.html
pandas.Series.str.isalpha — pandas 3.0.2 documentation
This is equivalent to running the Python string method str.isalpha() for each element of the Series/Index.
🌐
Scaler
scaler.com › home › topics › isalpha() in python
isalpha() in Python - Scaler Topics
April 7, 2024 - Some errors and exceptions are ... False. ... The method - isalpha() in python can be used for counting the number of alphabets or non-alphabets in a string....
🌐
AskPython
askpython.com › home › python string isalpha() function
Python String isalpha() Function - AskPython
August 6, 2022 - import unicodedata total_count = 0 for i in range(2 ** 16): charac = chr(i) if charac.isalpha(): print(u'{:04x}: {} ({})'.format(i, charac, unicodedata.name(charac, 'UNNAMED'))) total_count = total_count + 1 print("Total Count of Alpha Unicode Characters = ",total_count) ... It is just a glance of output as the actual output is lengthy. There are 48462 alpha characters in Unicode. ... I have been working on Python programming for more than 12 years.
🌐
Replit
replit.com › home › discover › how to use isalpha() in python
How to use isalpha() in Python | Replit
3 weeks ago - All characters in the string must be letters. This makes it an efficient way to validate user inputs like names or keywords before they are processed or stored, ensuring data integrity. Beyond its role in basic validation, isalpha() is also handy for filtering data, counting specific characters, and implementing more sophisticated user input checks. words = ["Python3", "Hello", "123", "World!", "ABC"] alphabetic_words = [word for word in words if word.isalpha()] print("Alphabetic words:", alphabetic_words)--OUTPUT--Alphabetic words: ['Hello', 'ABC']