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.
Asked
Active
Viewed 74 times
-10

Tancrede Chazallet
- 7,035
- 6
- 41
- 62

A.Danielli
- 1
- 2
-
3Please 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 Answers
0
- Use True/False instead of true/false. You can consider True and False as somehow 'keywords' in Python.
- For Python scripts, you don't use
def main():
. Instead, try usingif __name__ == '__main__':
under global scope. Look at this for more info. - You have to print something out rather than just return a boolean variable, by using print build-in function.
-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