Python Code Challenges: Control Flow (Advanced) Challenge 3 error in answers for Codecademy to update

https://www.codecademy.com/journeys/computer-science/paths/cscj-22-intro-to-programming/tracks/cscj-22-fundamentals-of-python/modules/cscj-22-python-code-challenges-i/articles/advanced-python-code-challenges-control-flow

Python Code Challenges: Control Flow (Advanced)

Challenge Three answer is incorrect:

The solution provided for the challenge 3 uses >0 or <0 which is incorrect on the first test below is false as the first test is as the number is 0 which is netiher > or <

#print(always_false(0)) which provides None as answer and not false
if (num > 0 and num < 0):
return True
else:
return False

This provide output as none

I had user #if num >=0 or <= 0: which provides the desired false for this output!!

To preserve code formatting in forum posts, see: [How to] Format code in posts

Can you post your properly formatted code?

What output does your code produce? What output does the solution code produce? Why do you think the solution is wrong?

Thankyou, after reviewing again both work EXCEPT the provided answer is much better and will always work. I also read into how to format code and will take on board :grinning: :pray:

1 Like