Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

klifka

  • 3 years ago

Hi everyone, small question. For lecture 6 I tried, before seeiing the answer, to write a bit of code for the palindrome problem. I wrote this: def IsPalin(word): if len(word)<=1: return 'input is palindrome' else: if word[0]!=word[-1]: return 'input is not a palindrome' else: word=word[1:-1] IsPalin(word) Ok, there is room for improv, but the issue I'm having is this: when I command eg print('kook'), it prints None! If I switch the return statements by print statements it returns stat and! None, why is this?

  • This Question is Closed

    Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy