while
>> a = 0
>> while a < 10: # or you can use a != 10
>> a = a + 1
>> print a
if - elif - else
>> a = 2
>> if a==2:
>> print 'okey, the value of a is 2'
or
>> if a==2:
>> print 'okey, the value of a is 2'
>> else:
>> print 'nop, the value of a is not 2'
or
>> if a==2:
>> print 'value of a is 2'
>> elif a==3:
>> print 'value of a is 3'
>> elif a>3:
>> print 'value of a is greater than 3'
>> else:
>> print 'value of a is not defined'
No comments:
Post a Comment