1# Method 1
2s = 'abcdefg'
3b = ""
4for i in range(len(s)):
5 if (i%2)==0:
6 b+=s[i]
7print(b)
8# Output 1
9>>> 'aceg'
10
11
12# Method 2
13s = 'abcdefg'[::2]
14print(s)
15# Output 2
16>>> 'aceg'
17
18
19# Method 3
20s = 'abcdefg'
21b = []
22for index, value in enumerate(s):
23 if index % 2 == 0:
24 b.append(value)
25b = "".join(b)
26print(b)
27# Output 3
28>>> 'aceg'
29
30
31# Method 4
32s = 'abcdefg'
33x = "".join(s[::2])
34print(x)
35# Output 4
36>>> 'aceg'