Computer Science Canada

Even Palindromes Help

Author:  mms6 [ Tue Oct 27, 2009 1:51 am ]
Post subject:  Even Palindromes Help

code:
def get_even_palindrome_at(user_input, index):
    user_input = user_input.lower()
    user_input = remove_non_words(user_input)
   
    start_index, end_index = index, index
   
    while start_index >= 0 and end_index < len(user_input):
        if user_input[start_index] == user_input[end_index]:
            start_index -= 1
            end_index += 1
        else:
            break

    result = ""
    count_index = start_index
   
    while count_index < end_index:
        result += user_input[count_index]
        count_index = count_index + 1
    return result





I get output "ou" from the Python Shell
What happened to the rest "ouuo"?

please, someone I need some assistance

Author:  A.J [ Tue Oct 27, 2009 12:42 pm ]
Post subject:  RE:Even Palindromes Help

set start_index = 0 and end_index = len(user_input) after the first loop.

Author:  SNIPERDUDE [ Tue Oct 27, 2009 1:05 pm ]
Post subject:  RE:Even Palindromes Help

Aibohphobia?

Author:  A.J [ Tue Oct 27, 2009 6:30 pm ]
Post subject:  RE:Even Palindromes Help

no, I am sure that's not the case here...


: