MCPcopy Create free account
hub / github.com/geekcomputers/Python / palindrome

Function palindrome

check whether the string is Symmetrical or Palindrome.py:1–19  ·  view source on GitHub ↗
(a)

Source from the content-addressed store, hash-verified

1def palindrome(a):
2 mid = (len(a) - 1) // 2
3 start = 0
4 last = len(a) - 1
5 flag = 0
6
7 while start < mid:
8 if a[start] == a[last]:
9 start += 1
10 last -= 1
11
12 else:
13 flag = 1
14 break
15
16 if flag == 0:
17 print("The entered string is palindrome")
18 else:
19 print("The entered string is not palindrome")
20
21
22def symmetry(a):

Calls

no outgoing calls

Tested by

no test coverage detected