Python Forum
Need to improve a programm
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to improve a programm
#4
In your is_palindrome function, you should use the text parameter you passed to the function, and you need to save the replacements back into that, to keep the changes:

    for i in forbidden:
        if i in text:
            text = text.replace(i,'')
    return text == reverse(text)
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
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,053 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