Python Add to Object Attribute
Go to solution
Solved by fizzlesticks,
1 minute ago, LtStaffel said:Sure, here:
The line
char
is never going to raise an exception since you define it as the loop variable. Which means you never create an instance of your class and inside the else clause 'char' is type 'str' not 'chars' like you expect. Strings have a built-in count function so doing 'char.count += 1' is trying to add a built-in function and an int just like error says.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now