Can't find what's wrong


Link to exercise:

This is the error i get:
TypeError: str returned non-string (type NoneType)

class BankAccount(object):
  balance = 0
  def __init__(self, name): = name
  def __repr__(self):
    print "%s's account. Current balance: $%.2f" % (, self.balance)
  def show_balance(self):
    print "Balance: $%.2f" % (self.balance)
  def deposit(self, amount):
    if amount <= 0:
      print "Ivalid deposit. Please enter a positive amount"
      print "Successfully deposited: $%.2f" % (amount)
      self.balance += amount

  def withdraw(self, amount):
    if amount > self.balance:
      print "Invalid withdrawal. The desired amount exceeds your balance"
      print "Successfully withdrew: $%.2f" % (amount)
      self.balance -= amount
my_account = BankAccount("Antonio")
print my_account
print my_account

Thanks for your help.


If that error message doesn’t immediately tell you what you need to change, then I’m not sure what information you’re looking for.

Perhaps there’s something you’d like to ask about whatever stops you? Don’t expect others to skip to the conclusion. Ask questions so that you can solve it yourself, and be specific about what you want to know


Despite the non-friendly mail response and no help received from the moderator ionathan, I managed to solve the problem. The topic can be closed, thanks.
On a side note, I’ve spent a good amount of money to learn on this site and I’ve only asked 2 questions in two months. TWO questions.
The question here was pretty clear and I find this response i got, starting with the sentence “If that error message doesn’t immediately tell you what you need to change, then I’m not sure what information you’re looking for”, totally unacceptable.
I understand that you want us to “learn how to learn”, but if I’m lost in some exercise/project I expect your professional help (which I paid for), not some ridiculous passive-aggressive “you’re a ***ard who asks stupid questions” response from a self-declared “cynical” mod.


Here’s the thing.
There was no question.
You stated the problem and expected someone else to take the driver’s seat.

Imagine someone stating that their homework doesn’t pass.
They don’t ask any questions, they want their homework fixed.
You’d probably tell them “good for you”, because it doesn’t seem like they’re looking to solve their own problems.

We do indeed have different perspectives on this, and rather than sharing mine, rather than putting effort into coming up with a diplomatic way of doing so, or putting myself directly at odds with you, I bailed out and removed my post.

As for “codecademy pro” that’s not this forum. And to use that you’d have to direct questions at advisors, and they are almost certainly of yet another attitude - something along the lines of trying to get you to move along and keeping you happy, but not necessarily being able to solve any problems. That’s capitalism for you.

Anyway, I’ll restore my post since it got through regardless.

The way you asked didn’t suit me. I shouldn’t have engaged at all.


I think you’re asking as if you payed to get an answer. Expecting not to have to explain your thoughts, expecting not to have to be the one driving the conversation.

And perhaps that would be fine.

But it’s more like you posted a question on a board at the supermarket. Kinda have to sell it a bit.

And no, I’m not calling you stupid. But when you have an error message pointing out exactly what’s up and it’s very relevant to what you just wrote, then you really really should be explaining why that wasn’t enough, what you’re missing. There may very well be perfectly good reasons, but whoever reads won’t know what those are unless you explain them.


The title is: “Can’t find what’s wrong”
The error: TypeError: str returned non-string (type NoneType)

My logic would be he got X error and he can’t find what’s wrong.
It was a “print” instead of a “return”.
It was 5 am here and I’ve been reading and studying all night. Was stuck on that thing for half an hour trying to understand what was wrong and I couldn’t see why.

You started with that ambiguos sentence your reply and then used the imperative three times in a single sentence. I don’t consider that to be the most kind answer you could’ve come up with.

Anyways, as you also stated, we have different perspective on this and an internet fight is pointless.
Thanks for trying to help, even if I don’t like your methods.
Have a nice day


I did not fit in here, no. A bit of context was needed in order to argue without that being conflict. And that was a botched bail-out on my part.
But I’d argue. I stand by that part. And I’d never tell you it was a print instead of a return. And I’d never ask anything for you, even if I saw it.


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