+ 1

Kindly help to improve this code if there is. N.B: the code is working perfectly

PALINDROME code https://code.sololearn.com/cd93Z3f71zV2/?ref=app

16th May 2020, 5:31 PM
Taofeeq Olawale Saad
2 Respostas
+ 1
Although it works....remember you can string "string methods" (while taking the input too). This is how I would do it... edited...so the phrase outputs correctly: p_phrase = input("Enter either a word or phrase: ").lower() if p_phrase.replace(' ', '') == p_phrase.replace(' ', '')[::-1]: print('\n\n' 'The phrase "{}" is a PALINDROME'.format(p_phrase)) else: print('\n\n' 'The phrase "{}" is not a PALINDROME'.format(p_phrase))
16th May 2020, 5:47 PM
rodwynnejones
rodwynnejones - avatar
+ 1
rodwynnejones Thanks for the update
16th May 2020, 6:22 PM
Taofeeq Olawale Saad