a=name11.count("t") name11.count("r") name11.count("u") name11.count("e")
b=name21.count("l") name21.count("o") name21.count("v") name21.count("e")
I can't see what's wrong here, but when I run the code it give attribute error. I tried swapping lines and looked for typos but there is none I saw.
CodePudding user response:
did you mean like this
print('welcome to the Love calculater')
name1=input('what is your name?\n')
name2=input('what is their name?\n')
name11=name1.lower()
name21=name2.lower()
a=name11.count("t") name11.count("r") name11.count("u") name11.count("e")
b=name21.count("l") name21.count("o") name21.count("v") name21.count("e")
....
is you?
CodePudding user response:
When you call a method/function without ()
, python don't call the actual method but it returns a function reference
in line number 8 & 9 you missed to call the method lower()
which means name11
is not a str
but a function reference
so the object don't have any method called count()