Whats The Problem in my code. Its show an unexpected error in python module


#1

MY CODE IS

main = raw_input("Please enter a word.")
main = main.lower
ay = "ay"
if len(main)>0 and main.isalpha():
mid = main[0]
res = main + mid + ay
res = res[1:len(res)]
print res
else:
print "please enter a valid word"

THE ERROR IS

Traceback (most recent call last):
File "python", line 4, in
TypeError: object of type 'builtin_function_or_method' has no len()


#2

main = main.lower

lower method syntax

str.lower()

you missed brackets


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.