(a)
| 20 | |
| 21 | |
| 22 | def symmetry(a): |
| 23 | n = len(a) |
| 24 | flag = 0 |
| 25 | |
| 26 | if n % 2: |
| 27 | mid = n // 2 + 1 |
| 28 | else: |
| 29 | mid = n // 2 |
| 30 | |
| 31 | start1 = 0 |
| 32 | start2 = mid |
| 33 | |
| 34 | while start1 < mid and start2 < n: |
| 35 | if a[start1] == a[start2]: |
| 36 | start1 = start1 + 1 |
| 37 | start2 = start2 + 1 |
| 38 | else: |
| 39 | flag = 1 |
| 40 | break |
| 41 | |
| 42 | if flag == 0: |
| 43 | print("The entered string is symmetrical") |
| 44 | else: |
| 45 | print("The entered string is not symmetrical") |
| 46 | |
| 47 | |
| 48 | string = "amaama" |
no outgoing calls
no test coverage detected