-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop_operator.py
More file actions
60 lines (45 loc) · 1.27 KB
/
Copy pathloop_operator.py
File metadata and controls
60 lines (45 loc) · 1.27 KB
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
44
45
46
47
48
49
50
51
#####***range***########
# for items in range(50,100,20):
# print(items)
# print(list(range(10,60,5)))
#####***enumerate***###### ---> *** enumerate() methodu itere edilebilir bir objenin(list, string, tuple vb) itemlarına
# *** birer index numarası verir.
# index = 0
# mesaj = "hello there"
# for harf in mesaj:
# print(f"index {index} harf {harf}")
# index+=1
###Bu işlemi enumerate ile nasıl yaparım
# mesaj = "hello"
# for index , harf in enumerate(mesaj):
# print(f"index {index} harf {harf}")
# \ /
# \ /
# \ /
# V
# index 0 harf h
# index 1 harf e
# index 2 harf l
# index 3 harf l
# index 4 harf o
# mesaj = "hello"
# for index in enumerate(mesaj):
# print(index)
# \ /
# \ /
# \ /
# V
# (0, 'h')
# (1, 'e')
# (2, 'l')
# (3, 'l')
# (4, 'o')
#####***zip***###### ---> İki farklı listeyi tuple olarak birleştirme.
# list1 = [1,2,3,4,5]
# list2 = ['a','b','c','d','e']
# list3 = [100,200,300,400,500]
# print(list(zip(list1, list2,list3)))
# for items in zip(list1, list2,list3):
# print(items)
# for a,b,c in zip(list1, list2,list3):
# print(a,b)