Issue
def palindrome(s):
s=input ("Enter a phrase (**use quotation marks for words**): ")
s.lower()
return s[::-1]==s
palindrome(s)
This is my code. How do I change it so I can take out the bolded section? I use python 2 and it won't accept string inputs without the quotation marks.
Solution
Use raw_input
instead of input
. In Python 2 input
tries to evaluate the user's input, so letters are evaluated as variables.
Answered By - DeepSpace
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.