[ create a new paste ] login | about

Link: http://codepad.org/vM1RU2Pd    [ raw code | output | fork ]

Python, pasted on Oct 27:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#Palindrome Iterative Style.

def listmaker(L):
        z = list(L)
        return z

def caller():
    x = raw_input('Enter the string for checking. ')
    L = listmaker(x)
    tester(L)

def tester(L):
    count = 0
    for i in range((len(L)/2)+1):
        if L[i] == L[-i-1] and i <= (len(L)/2):
            count += 1
            if count == (len(L)/2):
                print 'Congo u ve just found a Palindrome!'
        else: print 'test failed!'

caller()


Output:
1
2
3
4
5
6
Enter the string for checking. Traceback (most recent call last):
  Line 21, in <module>
    caller()
  Line 8, in caller
    x = raw_input('Enter the string for checking. ')
EOFError


Create a new paste based on this one


Comments: