codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#Palindrome Iterative Style. def caller(): x = raw_input('Enter the string for checking. ') # should work on the string without making it a list return tester(x) def tester(x): count = 0 for i in range(0, int(len(x)/2)+1): # if any of these do NOT match, it is not a palindrome if x[i] != x[-i-1]: return False # if you got here all the tests passed return True if caller(): print 'Congo u ve just found a Palindrome!' else: print 'test failed!'
Private
[
?
]
Run code
Submit