In [1]:
x = 0

while x < 10:
    print('x is currently: ', x)
    print(' x is still less than 10, adding 1 to x')
    x+=1


x is currently:  0
 x is still less than 10, adding 1 to x
x is currently:  1
 x is still less than 10, adding 1 to x
x is currently:  2
 x is still less than 10, adding 1 to x
x is currently:  3
 x is still less than 10, adding 1 to x
x is currently:  4
 x is still less than 10, adding 1 to x
x is currently:  5
 x is still less than 10, adding 1 to x
x is currently:  6
 x is still less than 10, adding 1 to x
x is currently:  7
 x is still less than 10, adding 1 to x
x is currently:  8
 x is still less than 10, adding 1 to x
x is currently:  9
 x is still less than 10, adding 1 to x

In [3]:
print('abcdefghijklmnopqrstuvwxyz'*10)


abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

In [11]:
x = 0

while x < 10:
    print('x is currently: ', x)
    print('   x is still less than 10, adding 1 to x')
    x+=1
    if x % 2 == 0:
        print('   this is an even number')
    else:
        print('   this is an odd number')
    if x == 7:
        break
else:
    print('all done!')


x is currently:  0
   x is still less than 10, adding 1 to x
   this is an odd number
x is currently:  1
   x is still less than 10, adding 1 to x
   this is an even number
x is currently:  2
   x is still less than 10, adding 1 to x
   this is an odd number
x is currently:  3
   x is still less than 10, adding 1 to x
   this is an even number
x is currently:  4
   x is still less than 10, adding 1 to x
   this is an odd number
x is currently:  5
   x is still less than 10, adding 1 to x
   this is an even number
x is currently:  6
   x is still less than 10, adding 1 to x
   this is an odd number

In [ ]: