Python Forum
Need to improve a programm
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to improve a programm
#1
The program checks if the input text is palindrome. After checking a text like "Rise to vote, sir." it wont find it as palindrome, even if it is. I need to improve a program so that it could ignore punctuation, spaces,case etc. I should specify a tuple "forbidden", where i place such characters, and use the membreship test to determine whether a character should be removed or not.
All my attempts of improving the program using that way crushed with different types of errors. Help me if u can, please.

Here is the initial version of the program
def reverse(text):
    return text[::-1]

def is_palindrome(text):              
    return text == reverse(text)

something = (input('Input something --> '))

if (is_palindrome(something)):
    print('The text is polyndrom')
else:
    print('The text is not polyndrom')
Reply


Messages In This Thread
Need to improve a programm - by Richard_SS - Mar-16-2019, 02:47 PM
RE: Need to improve a programm - by ichabod801 - Mar-16-2019, 03:25 PM
RE: Need to improve a programm - by Richard_SS - Mar-16-2019, 04:44 PM
RE: Need to improve a programm - by ichabod801 - Mar-16-2019, 09:19 PM
RE: Need to improve a programm - by Richard_SS - Mar-17-2019, 04:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Any pointers on my programm before I hand it in?(I'm new to python, so go easy on me) blacklight 3 2,862 Jul-07-2020, 01:19 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020