Results 1 to 2 of 2

Math Help - Python-conditions!!!

  1. #1
    Newbie
    Joined
    Dec 2007
    From
    UK
    Posts
    23

    Python-conditions!!!

    printing "B" in python??

    Attached!


    *
    Attached Files Attached Files
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Feb 2006
    From
    United Kingdom
    Posts
    70
    1.)
    prints 'B' if thing1 <= 10 evaluates to be true.

    2.)
    if thing1 > 200 is true.

    3.)
    never.
    if thing1 > 200. the first 'if-statement' is executed, thus the 'else if' statement is not. as the 'else' fails.

    4.)
    if not(thing1 > 10 and thing1 < 10) is true

    (thing1 > 10 and thing1 <10) is never true

    so the 'not' of something which is never true, is always true.

    so it always prints 'B.'
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Python nth prime
    Posted in the Math Software Forum
    Replies: 1
    Last Post: August 17th 2011, 12:06 AM
  2. Invalid syntax in Python
    Posted in the Math Software Forum
    Replies: 7
    Last Post: October 24th 2010, 06:29 PM
  3. Recurrence relations in Python
    Posted in the Math Software Forum
    Replies: 3
    Last Post: September 26th 2010, 07:47 AM
  4. Boolean Algebra...(python)
    Posted in the Math Software Forum
    Replies: 1
    Last Post: December 9th 2007, 10:01 AM
  5. python questions...please help!!
    Posted in the Math Software Forum
    Replies: 3
    Last Post: December 9th 2007, 09:06 AM

Search Tags


/mathhelpforum @mathhelpforum