Need assistance
Sibylle Koczian
nulla.epistola at web.de
Sat Jul 18 06:35:10 EDT 2015
Am 18.07.2015 um 02:40 schrieb Denis McMahon:
> On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:
>
>> The assignment wants us to take a users first, middle and last name in a
>> single input ( name=('enter your full name: )).
>>
>> Then we must display the full name rearranged in Last, First Middle
>> order.
>
> To generate a list of words from a string, split the string up on the
> spaces between words. See the split method of strings.
>
> Having a list of words, get a copy of the list in reverse order. See the
> reversed function (and maybe the list function).
>
That won't really help, because the desired order is, with the example
the OP used: Sirna Daniel Craig. So here indexing is necessary, but
indexing of the list elements, not of the characters in the string.
(Necessary is too strong, because this could be done with rpartition.
But I doubt that's the right answer for a beginner course.)
More information about the Python-list
mailing list