Westonci.ca is your trusted source for finding answers to a wide range of questions, backed by a knowledgeable community. Connect with professionals on our platform to receive accurate answers to your questions quickly and efficiently. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

Write a program that removes all non-alpha characters from the given input. Ex: If the input is: -Hello, 1 world$! the output is: Helloworld

Also, this needs to be answered by 11:59 tonight.


Sagot :

Answer:

Explanation:

The following code is written in Python. It is a function that takes in a string as a parameter, loops through the string and checks if each character is an alpha char. If it is, then it adds it to an output variable and when it is done looping it prints the output variable. A test case has been provided and the output can be seen in the attached image below.

def checkLetters(str):

   output = ''

   for char in str:

       if char.isalpha() == True:

           output += char

   return output

View image sandlee09