Hi, this is my first post on this mailing list-

I wanted to ask about this type of execution in python,

expected output-
reverse_words("This is an example!") # returns  "sihT si na !elpmaxe"


below is my execution, followed by another persons execution, which i dont
completely understand.

def reverse_words(strng):
  strng = strng[::-1].split(' ')
  strng.reverse()
  return ' '.join(strng)


def reverse_words(s)
    return ' '.join(s[::-1] for s in str.split(' '))



how can a for loop be called within another method like that- and possibly
what situations does this benefit
i don't even know how to google this sort of thing
any words are appreciated-



R
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to