using multiple 'if' statements in Python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RaZe
    New Member
    • Jul 2008
    • 3

    using multiple 'if' statements in Python

    Hi All,

    Can anyone please help me out about how can I use multiple 'if' statements in Python like C/C++?

    For example in C:
    *************** **************
    int a;
    a = 0;

    if ( a == 0 ) {
    printf "0";
    a = 1;
    }
    if ( a == 1 ) printf "1";
    *************** ***************
    How can I write these statements in Python Code?

    Thanks.
  • RaZe
    New Member
    • Jul 2008
    • 3

    #2
    OOPS! Sorry for that. Actually I got some errors in my regular expressions and assumed it as for that multiple 'if' statements!!!! Now I figured it out and solved it.

    Sorry for the inconvenience :-)

    Comment

    • jlm699
      Contributor
      • Jul 2007
      • 314

      #3
      In case you're still wondering the if, else structure in Python is:
      [code=python]
      if condition 1:
      action 1
      elif condition 2:
      action 2
      elif condition 3:
      action 3
      else:
      default action
      [/code]

      Comment

      Working...