-10

I'm new to python and I'm trying to write a function where the input is a string, and which return True if the string is a palindrome, otherwise returns False but the interpreter doesn't read the function.

this is the program

and the cmd window shows what happens

Tancrede Chazallet
  • 7,035
  • 6
  • 41
  • 62
  • 3
    Please read [How to ask a question](https://stackoverflow.com/help/how-to-ask) and paste the code here itself! – K DawG Dec 11 '15 at 13:09

3 Answers3

1

You should learn a new language using a book, not stackoverflow

Alexwang
  • 33
  • 6
0
  1. Use True/False instead of true/false. You can consider True and False as somehow 'keywords' in Python.
  2. For Python scripts, you don't use def main():. Instead, try using if __name__ == '__main__': under global scope. Look at this for more info.
  3. You have to print something out rather than just return a boolean variable, by using print build-in function.
Community
  • 1
  • 1
yiliangt5
  • 16
  • 1
  • 3
-1

Well your code doesn't work because there's no such thing as false or true in Python. They are represented as True with capital T and False with capital F. So change it that way. Also you need to print out ex2(str1):

print ex2(str1)

Emre Aydin
  • 11
  • 2
  • I don't think those are the only problems. I tried making those changes and the program still doesn't do anything. – Kevin Dec 11 '15 at 13:26