Fundamentals
Strings
Data Types
Algorithms
Logic
A palindrome is a word spelt the same forwards and backwards.
If word is not a palindrome return False and if word is a palindrome return True.
Examples:
anna = True
hotdog = False
civic = True
kayak = True
codewars = False
def palindrome(word):
if word[::-1] == word:
return True
else:
return False
test.assert_equals(palindrome('A'), True)
test.assert_equals(palindrome('a'), True)
test.assert_equals(palindrome('aa'), True)
test.assert_equals(palindrome('aba'), True)
test.assert_equals(palindrome('acca'), True)
test.assert_equals(palindrome('adda'), True)
test.assert_equals(palindrome('affa'), True)
test.assert_equals(palindrome('aga'), True)
test.assert_equals(palindrome('aha'), True)
test.assert_equals(palindrome('ajaja'), True)
test.assert_equals(palindrome('aka'), True)
test.assert_equals(palindrome('ala'), True)
test.assert_equals(palindrome('alala'), True)
test.assert_equals(palindrome('alula'), True)
test.assert_equals(palindrome('ama'), True)
test.assert_equals(palindrome('amma'), True)
test.assert_equals(palindrome('ana'), True)
test.assert_equals(palindrome('anana'), True)
test.assert_equals(palindrome('anna'), True)
test.assert_equals(palindrome('apa'), True)
test.assert_equals(palindrome('ara'), True)
test.assert_equals(palindrome('arara'), True)
test.assert_equals(palindrome('atta'), True)
test.assert_equals(palindrome('ava'), True)
test.assert_equals(palindrome('awa'), True)
test.assert_equals(palindrome('B'), True)
test.assert_equals(palindrome('b'), True)
test.assert_equals(palindrome('bib'), True)
test.assert_equals(palindrome('bob'), True)
test.assert_equals(palindrome('boob'), True)
test.assert_equals(palindrome('bub'), True)
test.assert_equals(palindrome('C'), True)
test.assert_equals(palindrome('c'), True)
test.assert_equals(palindrome('civic'), True)
test.assert_equals(palindrome('D'), True)
test.assert_equals(palindrome('d'), True)
test.assert_equals(palindrome('dad'), True)
test.assert_equals(palindrome('deed'), True)
test.assert_equals(palindrome('deedeed'), True)
test.assert_equals(palindrome('degged'), True)
test.assert_equals(palindrome('did'), True)
test.assert_equals(palindrome('dod'), True)
test.assert_equals(palindrome('dud'), True)
test.assert_equals(palindrome('E'), True)
test.assert_equals(palindrome('e'), True)
test.assert_equals(palindrome('eke'), True)
test.assert_equals(palindrome('elle'), True)
test.assert_equals(palindrome('eme'), True)
test.assert_equals(palindrome('ere'), True)
test.assert_equals(palindrome('eve'), True)
test.assert_equals(palindrome('ewe'), True)
test.assert_equals(palindrome('eye'), True)
test.assert_equals(palindrome('F'), True)
test.assert_equals(palindrome('f'), True)
test.assert_equals(palindrome('G'), True)
test.assert_equals(palindrome('g'), True)
test.assert_equals(palindrome('gag'), True)
test.assert_equals(palindrome('gig'), True)
test.assert_equals(palindrome('gog'), True)
test.assert_equals(palindrome('H'), True)
test.assert_equals(palindrome('h'), True)
test.assert_equals(palindrome('hah'), True)
test.assert_equals(palindrome('hallah'), True)
test.assert_equals(palindrome('huh'), True)
test.assert_equals(palindrome('I'), True)
test.assert_equals(palindrome('i'), True)
test.assert_equals(palindrome('ihi'), True)
test.assert_equals(palindrome('imi'), True)
test.assert_equals(palindrome('immi'), True)
test.assert_equals(palindrome('J'), True)
test.assert_equals(palindrome('j'), True)
test.assert_equals(palindrome('K'), True)
test.assert_equals(palindrome('k'), True)
test.assert_equals(palindrome('kakkak'), True)
test.assert_equals(palindrome('kayak'), True)
test.assert_equals(palindrome('keek'), True)
test.assert_equals(palindrome('kelek'), True)
test.assert_equals(palindrome('L'), True)
test.assert_equals(palindrome('l'), True)
test.assert_equals(palindrome('lemel'), True)
test.assert_equals(palindrome('level'), True)
test.assert_equals(palindrome('M'), True)
test.assert_equals(palindrome('m'), True)
test.assert_equals(palindrome('maam'), True)
test.assert_equals(palindrome('madam'), True)
test.assert_equals(palindrome('mem'), True)
test.assert_equals(palindrome('mesem'), True)
test.assert_equals(palindrome('mim'), True)
test.assert_equals(palindrome('minim'), True)
test.assert_equals(palindrome('mum'), True)
test.assert_equals(palindrome('murdrum'), True)
test.assert_equals(palindrome('N'), True)
test.assert_equals(palindrome('n'), True)
test.assert_equals(palindrome('nan'), True)
test.assert_equals(palindrome('non'), True)
test.assert_equals(palindrome('noon'), True)
test.assert_equals(palindrome('nun'), True)
test.assert_equals(palindrome('O'), True)
test.assert_equals(palindrome('o'), True)
test.assert_equals(palindrome('oho'), True)
test.assert_equals(palindrome('otto'), True)
test.assert_equals(palindrome('P'), True)
test.assert_equals(palindrome('p'), True)
test.assert_equals(palindrome('pap'), True)
test.assert_equals(palindrome('peep'), True)
test.assert_equals(palindrome('pep'), True)
test.assert_equals(palindrome('pip'), True)
test.assert_equals(palindrome('poop'), True)
test.assert_equals(palindrome('pop'), True)
test.assert_equals(palindrome('pup'), True)
test.assert_equals(palindrome('Q'), True)
test.assert_equals(palindrome('q'), True)
test.assert_equals(palindrome('R'), True)
test.assert_equals(palindrome('r'), True)
test.assert_equals(palindrome('radar'), True)
test.assert_equals(palindrome('redder'), True)
test.assert_equals(palindrome('refer'), True)
test.assert_equals(palindrome('repaper'), True)
test.assert_equals(palindrome('retter'), True)
test.assert_equals(palindrome('rever'), True)
test.assert_equals(palindrome('reviver'), True)
test.assert_equals(palindrome('rotator'), True)
test.assert_equals(palindrome('rotor'), True)
test.assert_equals(palindrome('S'), True)
test.assert_equals(palindrome('s'), True)
test.assert_equals(palindrome('siris'), True)
test.assert_equals(palindrome('sis'), True)
test.assert_equals(palindrome('sooloos'), True)
test.assert_equals(palindrome('T'), True)
test.assert_equals(palindrome('t'), True)
test.assert_equals(palindrome('tat'), True)
test.assert_equals(palindrome('tebbet'), True)
test.assert_equals(palindrome('teet'), True)
test.assert_equals(palindrome('tenet'), True)
test.assert_equals(palindrome('terret'), True)
test.assert_equals(palindrome('tit'), True)
test.assert_equals(palindrome('toot'), True)
test.assert_equals(palindrome('tot'), True)
test.assert_equals(palindrome('tst'), True)
test.assert_equals(palindrome('tut'), True)
test.assert_equals(palindrome('tyt'), True)
test.assert_equals(palindrome('U'), True)
test.assert_equals(palindrome('u'), True)
test.assert_equals(palindrome('ulu'), True)
test.assert_equals(palindrome('ululu'), True)
test.assert_equals(palindrome('umu'), True)
test.assert_equals(palindrome('utu'), True)
test.assert_equals(palindrome('V'), True)
test.assert_equals(palindrome('v'), True)
test.assert_equals(palindrome('W'), True)
test.assert_equals(palindrome('w'), True)
test.assert_equals(palindrome('waw'), True)
test.assert_equals(palindrome('wow'), True)
test.assert_equals(palindrome('X'), True)
test.assert_equals(palindrome('x'), True)
test.assert_equals(palindrome('Y'), True)
test.assert_equals(palindrome('y'), True)
test.assert_equals(palindrome('yaray'), True)
test.assert_equals(palindrome('yoy'), True)
test.assert_equals(palindrome('Z'), True)
test.assert_equals(palindrome('z'), True)
test.assert_equals(palindrome('Absence'), False)
test.assert_equals(palindrome('Justify'), False)
test.assert_equals(palindrome('Academic'), False)
test.assert_equals(palindrome('kitchen'), False)
test.assert_equals(palindrome('Accompany'), False)
test.assert_equals(palindrome('knee'), False)
test.assert_equals(palindrome('Accomplish'), False)
test.assert_equals(palindrome('knife'), False)
test.assert_equals(palindrome('Acknowledge'), False)
test.assert_equals(palindrome('knock'), False)
test.assert_equals(palindrome('Adapt'), False)
test.assert_equals(palindrome('know'), False)
test.assert_equals(palindrome('Administration'), False)
test.assert_equals(palindrome('Knowledge'), False)
test.assert_equals(palindrome('Affect'), False)
test.assert_equals(palindrome('land'), False)
test.assert_equals(palindrome('Afford '), False)
test.assert_equals(palindrome('landscape'), False)
test.assert_equals(palindrome('Analysis'), False)
test.assert_equals(palindrome('language'), False)
test.assert_equals(palindrome('Apparently'), False)
test.assert_equals(palindrome('lap'), False)
test.assert_equals(palindrome('Background'), False)
test.assert_equals(palindrome('large'), False)
test.assert_equals(palindrome('Balance'), False)
test.assert_equals(palindrome('largely'), False)
test.assert_equals(palindrome('Besides'), False)
test.assert_equals(palindrome('Last'), False)
test.assert_equals(palindrome('Beside'), False)
test.assert_equals(palindrome('manufacturing'), False)
test.assert_equals(palindrome('Beyond'), False)
test.assert_equals(palindrome('many'), False)
test.assert_equals(palindrome('Borrow'), False)
test.assert_equals(palindrome('map'), False)
test.assert_equals(palindrome('Boundary'), False)
test.assert_equals(palindrome('margin'), False)
test.assert_equals(palindrome('Budget'), False)
test.assert_equals(palindrome('mark'), False)
test.assert_equals(palindrome('Building'), False)
test.assert_equals(palindrome('market'), False)
test.assert_equals(palindrome('Business'), False)
test.assert_equals(palindrome('Marketing'), False)
test.assert_equals(palindrome('Calculate'), False)
test.assert_equals(palindrome('negotiation'), False)
test.assert_equals(palindrome('Campaign'), False)
test.assert_equals(palindrome('neighbor'), False)
test.assert_equals(palindrome('Campus'), False)
test.assert_equals(palindrome('neighborhood'), False)
test.assert_equals(palindrome('Capability'), False)
test.assert_equals(palindrome('neither'), False)
test.assert_equals(palindrome('Capacity'), False)
test.assert_equals(palindrome('Nerve'), False)
test.assert_equals(palindrome('Category'), False)
test.assert_equals(palindrome('objective'), False)
test.assert_equals(palindrome('Challenge'), False)
test.assert_equals(palindrome('obligation'), False)
test.assert_equals(palindrome('Characteristic'), False)
test.assert_equals(palindrome('observation'), False)
test.assert_equals(palindrome('Civil'), False)
test.assert_equals(palindrome('Observe'), False)
test.assert_equals(palindrome('Coalition'), False)
test.assert_equals(palindrome('opportunity'), False)
test.assert_equals(palindrome('Colonial'), False)
test.assert_equals(palindrome('Oppose'), False)
test.assert_equals(palindrome('Deal'), False)
test.assert_equals(palindrome('porch'), False)
test.assert_equals(palindrome('Defensive'), False)
test.assert_equals(palindrome('port'), False)
test.assert_equals(palindrome('Democracy'), False)
test.assert_equals(palindrome('portion'), False)
test.assert_equals(palindrome('Description'), False)
test.assert_equals(palindrome('portrait'), False)
test.assert_equals(palindrome('Dialogue'), False)
test.assert_equals(palindrome('portray'), False)
test.assert_equals(palindrome('Dimension'), False)
test.assert_equals(palindrome('pose'), False)
test.assert_equals(palindrome('Discrimination'), False)
test.assert_equals(palindrome('Position'), False)
test.assert_equals(palindrome('Distinction'), False)
test.assert_equals(palindrome('qualify'), False)
test.assert_equals(palindrome('Distinguish'), False)
test.assert_equals(palindrome('quality'), False)
test.assert_equals(palindrome('elementary'), False)
test.assert_equals(palindrome('Quarter'), False)
test.assert_equals(palindrome('eliminate'), False)
test.assert_equals(palindrome('quit'), False)
test.assert_equals(palindrome('elite'), False)
test.assert_equals(palindrome('quite'), False)
test.assert_equals(palindrome('else'), False)
test.assert_equals(palindrome('Quote'), False)
test.assert_equals(palindrome('elsewhere'), False)
test.assert_equals(palindrome('recipe'), False)
test.assert_equals(palindrome('e-mail'), False)
test.assert_equals(palindrome('Recognition'), False)
test.assert_equals(palindrome('embrace'), False)
test.assert_equals(palindrome('refugee'), False)