In [ ]:
In [1]:
x = 1
x = x + 1
x = x + 1
x = x + 1
print x
In [3]:
while x <= 100:
x = x + 1
print x
In [5]:
def countdown(n):
x = n
while x > 0:
print x
x = x - 1
countdown(10)
In [8]:
def print_n(s, n):
while n > 0:
print s
n = n - 1
print_n("xkcd", 5)
In [9]:
while True:
line = raw_input('> ')
if line == 'done':
break
print line
print 'Done!'
In [16]:
a = 42.0
x = 33.0
while True:
print x
y = float( (x + a/x) / 2 )
if y == x:
break
x = y
In [17]:
import math
print math.sqrt(42)
In [ ]: