Woohoo! first one in a while i've been able to get without going to the Q&A on this section. I'm definitely going to have to go over this section again, but I feel like my code is just so messy and probably way longer than it needs to be. Can anyone give me some pointers for how to cut down on the code?
def reverse(string): lst =  #create an empty list revlst =  string = str(string) #make sure the variable is a string for i in string: #take each letter in the string lst.append(i) #append to the list a = len(lst) #get length of the list for i in string: #for each letter in the string revlst.append(lst[a-1]) #append in reverse a -= 1 #count backwards to append to newlist con_revlst = ''.join([str(mli) for mli in revlst]) #join the reversed list into a new list return con_revlst print reverse("helpwhoknow!swhatsgoinon")
Also just making sure I can format correctly when posting to Q&A...