2 Replies - 206 Views - Last Post: 24 June 2013 - 10:22 AM Rate Topic: -----

#1 DblAAssassin  Icon User is offline

  • D.I.C Regular

Reputation: 33
  • View blog
  • Posts: 257
  • Joined: 11-May 13

Error?

Posted 23 June 2013 - 08:07 PM

So I'm using Codecademy to learn Python, and it is not passing the activity, the second if statement is not returning False. Even though it is. Just wondering is it is the website messing up or if I'm having a silly syntax error.
def true_function():
    if 90 == 90:                
        return True
        
def false_function():
    if 90 != 90:              
        return False        



See if it works for yourself... http://www.codecadem...788890003000096

Is This A Good Question/Topic? 0
  • +

Replies To: Error?

#2 Mekire  Icon User is offline

  • D.I.C Head

Reputation: 116
  • View blog
  • Posts: 212
  • Joined: 11-January 13

Re: Error?

Posted 23 June 2013 - 09:59 PM

View PostDblAAssassin, on 24 June 2013 - 03:07 AM, said:

So I'm using Codecademy to learn Python, and it is not passing the activity, the second if statement is not returning False. Even though it is. Just wondering is it is the website messing up or if I'm having a silly syntax error.
def true_function():
    if 90 == 90:                
        return True
        
def false_function():
    if 90 != 90:              
        return False        



See if it works for yourself... http://www.codecadem...788890003000096
Your second function is returning None instead of False. Since 90 is equal to 90, the if block doesn't run. If you had say:
if 90 != 0:
it would work. The statement below the if only runs if its conditional is True. 90 != 90 is False so the return statement doesn't execute and you get the default return of None.

-Mek
Was This Post Helpful? 1
  • +
  • -

#3 DblAAssassin  Icon User is offline

  • D.I.C Regular

Reputation: 33
  • View blog
  • Posts: 257
  • Joined: 11-May 13

Re: Error?

Posted 24 June 2013 - 10:22 AM

Thank you!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1