Python - jednoduchý cyklus while

Z GeoWikiCZ

Ukázka použití jednoduchých cyklů

#!/usr/bin/python

# Fibonacciho posloupnost 
a = b = 1
print b
while a < 100:
   print a
   a = a + b
   b = a - b
#!/usr/bin/python

import math

s = c = x = 0.4
n = 1

while abs(c) > 1e-12:
   c = -c*x*x
   c = c/(n+1)/(n+2)
   n = n + 2
   s = s + c

print s
print math.sin(x)