My number is correct but it isn't accepting it?

Issue with the UI. I uncommented the (10) and got the correct answer BUT the UI complains that I should have returned 15.
See screenshot
Google Photos

wait, there’s more! It gets better/worse… I supply the ‘correct answer’ and the UI still complains that it returned 15 and expected 15!
Google Photos

2 Likes

Is there a reason to be casting everything to str? print() can handle numbers just fine, and we should be returning a number to the caller, not a string.

1 Like

Yep. Good point re: str(print). You are right. It is unnecessary.
I have been doing a lot of formatting str and num in sentences, I got carried away.

1 Like

had this problem as well. nothing i did would let me clear it. quite frustrating

Can this be an option?

def first_three_multiples(num):
return print( str(num) + ', ’ + str((num2)) + ', ’ + str((num3)) + ', and return ’ + str((num*3)) )

It fits the requirement, but I don’t know if something wrong.

I think the expected answer is ‘number’ not ‘string’ nor ‘str(number)’.
Unlike to our human eyes, they might be totally different to that of machine.

I am having the exact same problems. Even though my code returns a value I still get a message saying, "first_three_multiples(5) returned None, expected 15."

I rewrote the code to just return the number 15. I converted it into a string, I converted it into an integer, but I still got the same result.

No matter what I do I can’t seem to clear this lesson. Does anybody have a solution that works?

The thing to do here is to go back to that return statement and be sure it doesn’t include a print. There should be a str value in the return. print will return None which will then be returned to the caller.

Oh, I see what I am doing wrong. It wanted me to print the three values and return only the third. I should have read more carefully.

Thanks for your help.

1 Like