Is the solution is wrong?


#1

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


FAQ: Code Challenge: Control Flow - Twice as Large
#2

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.


#3

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.


#4

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.


#5

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.


#6

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.