Python - Using while loop to count value

Introduction

The following code counts from the value of a up to, but not including, b.

Demo

a=0; b=10 
while a < b:              # One way to code counter loops 
    print(a, end=' ') 
    a += 1                # Or, a = a + 1
# from w ww. ja  v a 2 s  .co m

Result

Related Topic