python else if statement

Is actually a elif statement. Here is an example below

python else if statement


>>> x = int(raw_input("Please enter a number: "))
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'

Comments

Popular posts from this blog

Vim vi how to reload a file your editing