Question: Python 3 Program: Write a function that takes a string as argument, and creates a new string that is a copy of the argument, except

Python 3 Program: Write a function that takes a string as argument, and creates a new string that is a copy of the argument, except that every non-letter is deleted (e.g., "ph@t l00t" is changed to "phtlt"). To write such a function, you will start with an empty string, and traverse the characters of the argument one by one. When you encounter a character that is acceptable, you add it to the new string. When it is not acceptable, you add nothing to the new string. Note that you can check whether a character is acceptable by simple comparisons. Use the function in a program that asks the user for a string and returns the transformed string. 

examples

% python3 ch10_03.py enter a string: alks9237&^#%$sjhsd[skjd]skdh{ksjd}wiu alkssjhsdskjdskdhksjdwiu % python3 ch10_03.py enter a string: qwe123 qwe % python3 ch10_03.py enter a string: q9q8q7q6q5q4 qqqqqq 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!