Йоана обнови решението на 03.04.2015 16:33 (преди над 9 години)
+def fibonacci():
+ value1 = 1
+ value2 = 1
+ yield value1
+ yield value2
+ while True :
+ yield value1 + value2
+ c=value2
+ value2=value1 + value2
+ value1=c
+def primes():
+ yield 2
+ n=3
+ while n :
+ bool=True
+ for i in range(2,n) :
+ if n%i == 0 :
+ bool=False
+ break
+ if bool == True :
+ yield n
+ n+=1
+
+def alphabet(code='', letters='') :
+ if letters != "" :
+ for i in list(letters) :
+ yield i
+ else :
+ if code == "lat" :
+ for i in range(97, 123) :
+ yield chr(i)
+ elif code == "bg" :
+ yield 'а'
+ yield 'б'
+ yield 'в'
+ yield 'г'
+ yield 'д'
+ yield 'е'
+ yield 'ж'
+ yield 'з'
+ yield 'и'
+ yield 'й'
+ yield 'к'
+ yield 'л'
+ yield 'м'
+ yield 'н'
+ yield 'о'
+ yield 'п'
+ yield 'р'
+ yield 'с'
+ yield 'т'
+ yield 'у'
+ yield 'ф'
+ yield 'х'
+ yield 'ц'
+ yield 'ч'
+ yield 'ш'
+ yield 'щ'
+ yield 'ъ'
+ yield 'ь'
+ yield 'ю'
+ yield 'я'
+
+
+
+
+
+
+