Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Even Palindromes Help
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mms6




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
A.J




PostPosted: 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.
SNIPERDUDE




PostPosted: Tue Oct 27, 2009 1:05 pm   Post subject: RE:Even Palindromes Help

Aibohphobia?
A.J




PostPosted: Tue Oct 27, 2009 6:30 pm   Post subject: RE:Even Palindromes Help

no, I am sure that's not the case here...
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: