- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerators.py
More file actions
Latest commit
43 lines (33 loc) · 706 Bytes
/
Copy pathgenerators.py
File metadata and controls
43 lines (33 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
importtypes
# Basic
deftest():
print("emre")
yield1
print("cetin")
yield2
foritreator_objeintest():
print("----")
defgerisay(sayi):
whilesayi>0:
yieldsayi
sayi-=1
print("3'ten geri sayiniz : ")
a=gerisay(3)
print(next(a))
print(next(a))
print(next(a))
# Fibonacci Örneği
deffibonacci():
a, b=1, 1
while1:
yielda
a, b=b, a+b
# Fibonacci Test
ifisinstance(fibonacci(), types.GeneratorType):
print("\nGood, The fib function is a generator")
step=int(input("How many step do you want to see ? : "))
forninfibonacci():
print(n)
step-=1
ifstep==0:
break