When i’m on codingbat.com, i saw this question that asks: Given a string, return a new string where the first and last chars have been exchanged and i answered:
def front_back(str): string = str[len(str)-1]+str[1:len(str)-1]+str return(string)
And codingbat told me string index out of range. I tested it on python 3.8.2 on my computer and it works fine. I’m a noob at programming. Help plz.