Is the solution is wrong?

Return True if num1 is more than double num2 . Return False otherwise.

Doesn’t this mean that num1 needs to be twice the size of num2. If so that means the solution is wrong:

def twice_as_large(num1, num2):
if num1 > 2 * num2:
return True
else:
return False

Uncomment these funct

Please post the URL of the exercise page in question.

If we are to take the function’s name as it reads, then it should be equality, not inequality. We’ll know more when we’ve read the exercise.

1 Like

I think that’s poorly written, it doesn’t need an if-statement at all because the result of the expression is already a boolean and can be returned directly.

However, I can’t figure out what you mean by wrong. Perhaps you’d like to include a test case where it produces an incorrect answer, and maybe elaborate on your explanation on in what way it is wrong, specifically how it’s different from what you say it should be.
Additionally, that doesn’t execute at all due to incorrect formatting.

def twice_as_large(num1, num2):
if num1 > 2 * num2:
return True
else:
return False
--
  File "<ipython-input-1-407f8328f9f4>", line 2
    if num1 > 2 * num2:
     ^
IndentationError: expected an indented block

“fixing” it is extra work, might not be possible, might change it to something else, and even if successful comes with a loss of confidence and therefore introduces a bunch of guesswork regardless - all of which can be avoided by making an accurate copy from the start.

2 Likes

Hopefully it’s not being taken literally, as sting expressions.

'num1' > 'num2'    # False

We still need to read the instructions to see what is expected. If the function name is explicit then we expect equality.

1 Like

Instructions saying more than double are there. And exactly twice as much would be wrong according to instructions, it needs to be more than that.

In any case, unclear what the perceived difference is.

1 Like

Twice as large would mean double, a state of equalling exactly two times as much. Anything more than that would be valid if we were looking for double_or_greater_than_double, which function name I would never use but the instructors here seem to love them.

1 Like

def twice_as_large(num1, num2):
if num1 < num2 *2 or num1 == num2 * 2:
return False
else:
return True