fork download
  1. # your code goes here
  2. input = 'racecar'
  3.  
  4. #Gets lengths of input
  5. full_length = len(input)
  6. split_length = len(input) / 2
  7.  
  8. #If word has an even length split like this
  9. if full_length % 2 == 0:
  10. first_half = input[:split_length]
  11. second_half = input[split_length:]
  12.  
  13. #If word does not have even length split like this
  14. else:
  15. first_half = input[:split_length+1]
  16. second_half = input[split_length:]
  17.  
  18. print first_half
  19. print second_half
  20.  
  21. rev_second_half = second_half[::-1]
  22.  
  23. print rev_second_half
  24.  
  25. """
  26. #Check to see if both lists are identical
  27.  
  28. #If they are identical
  29. print "This word is a palindrome!"
  30.  
  31. #If they are not identical
  32. print "This word is not a palindrome."
  33. """
Success #stdin #stdout 0.01s 7692KB
stdin
Standard input is empty
stdout
race
ecar
race