Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
8
Task/Phrase-reversals/Python/phrase-reversals.py
Normal file
8
Task/Phrase-reversals/Python/phrase-reversals.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
>>> phrase = "rosetta code phrase reversal"
|
||||
>>> phrase[::-1] # Reversed.
|
||||
'lasrever esarhp edoc attesor'
|
||||
>>> ' '.join(word[::-1] for word in phrase.split()) # Words reversed.
|
||||
'attesor edoc esarhp lasrever'
|
||||
>>> ' '.join(word for word in phrase.split()[::-1]) # Word order reversed.
|
||||
'reversal phrase code rosetta'
|
||||
>>>
|
||||
Loading…
Add table
Add a link
Reference in a new issue