Thursday, August 31, 2017

python control flow if elif else

a = 5
>>> a=7
>>> if a==5: print 5
... elif a==6: print 6
... else: print 0
...
0
>>> a=7
>>> if a==5: print 5
... elif a==6: print 6
... elif a==7: print 7
... else: print 0
...
7
>>> a=8
>>> if a==5: print 5
... elif a==7: print 7
... elif a==6: print 6
... else: print 0
...
0

No comments:

Post a Comment