python if else statements
Python uses colon after the if else keyword and indentation instead of curly brackets for code in the if else block.
#! /usr/bin/env python a=5 #Declares an integer, and assigns a value. if(a>10): print "This will never gets printed." else: print "a=5" print "5 is not greater than 10." if(a>5): print "This will never gets printed." elif(a<6): print "This will never gets printed." else: print "Correct" print "a is equal to 5."
Output:
a=5, 5 is not greater than 10. Correct, a is equal to 5.
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts