Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93975 > unrolled thread
| Started by | craig.sirna@gmail.com |
|---|---|
| First post | 2015-07-16 19:15 -0700 |
| Last post | 2015-07-20 15:25 +1000 |
| Articles | 20 on this page of 31 — 16 participants |
Back to article view | Back to comp.lang.python
Need assistance craig.sirna@gmail.com - 2015-07-16 19:15 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-16 20:40 -0600
Re: Need assistance craig.sirna@gmail.com - 2015-07-16 20:00 -0700
RE: Need assistance "Joseph Lee" <joseph.lee22590@gmail.com> - 2015-07-16 20:12 -0700
RE: Need assistance "Joseph Lee" <joseph.lee22590@gmail.com> - 2015-07-16 19:44 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-16 21:00 -0600
Re: Need assistance Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-07-17 16:40 +0000
Re: Need assistance Igor Korot <ikorot01@gmail.com> - 2015-07-17 12:54 -0400
Re: Need assistance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-17 20:00 +0100
Re: Need assistance Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-18 00:40 +0000
Re: Need assistance Sibylle Koczian <nulla.epistola@web.de> - 2015-07-18 12:35 +0200
Re: Need assistance Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-19 00:59 +0000
Re: Need assistance MRAB <python@mrabarnett.plus.com> - 2015-07-19 17:35 +0100
flipping string order Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-19 18:06 +0000
Re: Need assistance Laura Creighton <lac@openend.se> - 2015-07-18 14:16 +0200
RE: Need assistance "Joseph Lee" <joseph.lee22590@gmail.com> - 2015-07-18 09:05 -0700
Re: Need assistance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-18 12:18 -0400
Re: Need assistance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-18 18:34 +0100
Re: Need assistance mm0fmf <none@mailinator.com> - 2015-07-18 19:51 +0100
Re: Need assistance Joel Goldstick <joel.goldstick@gmail.com> - 2015-07-18 15:10 -0400
Re: Need assistance mm0fmf <none@mailinator.com> - 2015-07-18 20:35 +0100
Re: Need assistance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-18 17:44 -0400
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-18 20:46 -0600
Re: Need assistance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-18 17:34 -0400
Re: Need assistance William Ray Wing <wrw@mac.com> - 2015-07-18 14:28 -0400
Re: Need assistance MRAB <python@mrabarnett.plus.com> - 2015-07-19 01:14 +0100
Re: Need assistance craig.sirna@gmail.com - 2015-07-19 16:06 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-19 17:56 -0600
Re: Need assistance Rick Johnson <rantingrickjohnson@gmail.com> - 2015-07-19 17:21 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-19 23:16 -0600
Re: Need assistance Chris Angelico <rosuav@gmail.com> - 2015-07-20 15:25 +1000
Page 1 of 2 [1] 2 Next page →
| From | craig.sirna@gmail.com |
|---|---|
| Date | 2015-07-16 19:15 -0700 |
| Subject | Need assistance |
| Message-ID | <225d4ac6-3b88-4844-805b-b4b00cd62ef4@googlegroups.com> |
I need help writing a homework program.
I'll write it, but I can't figure out how to incorporate what I have read in the book to work in code.
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.
I tried to use the search function in Python to locate any spaces in the input. It spot back the index 5 (I used Craig Daniel Sirna)
That is correct for the first space, but I can't figure out how to get it to continue to the next space.
The indexing process is also a bit confusingto me.
I get that I can use len(fullName) to set the length of the index, and how the index is counted, but after that I'm lost.
I have emailed my professor a few times, but haven't gotten a response.(online course)
Any help would be greatly appreciated.
[toc] | [next] | [standalone]
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Date | 2015-07-16 20:40 -0600 |
| Message-ID | <mailman.619.1437100840.3674.python-list@python.org> |
| In reply to | #93975 |
On 07/16/2015 08:15 PM, craig.sirna@gmail.com wrote:
> I need help writing a homework program.
>
> I'll write it, but I can't figure out how to incorporate what I have
> read in the book to work in code.
Can you post the code that you are currently working with?
> 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.
>
> I tried to use the search function in Python to locate any spaces in
> the input. It spot back the index 5 (I used Craig Daniel Sirna)
Which search function are you talking about? Is it a string method or
something else?
One of the first string methods I learned about when I first started
with Python was the .split() method. For example, in the interactive
shell try this:
>>> a="one,two,three"
>>> a.split(',')
Does this help at all?
> That is correct for the first space, but I can't figure out how to
> get it to continue to the next space.
> The indexing process is also a bit confusingto me.
Which part of indexing is confusing? The syntax for slicing? I admit I
sometimes find it a bit complicated to know when and where to use -1 as
the index.
> I get that I can use len(fullName) to set the length of the index,
> and how the index is counted, but after that I'm lost.
>
> I have emailed my professor a few times, but haven't gotten a
> response.(online course)
>
> Any help would be greatly appreciated.
Again, show us the code you have so far and maybe we can help you figure
it out.
[toc] | [prev] | [next] | [standalone]
| From | craig.sirna@gmail.com |
|---|---|
| Date | 2015-07-16 20:00 -0700 |
| Message-ID | <3f8d701e-1d52-403d-9fc2-baa74e2159e4@googlegroups.com> |
| In reply to | #93976 |
I am in bed, on my phone, gotta be up in 4 hours for work. I will get back with you guys tomorrow after I take care of my Math class stuff. I need to step away from this for a day lol. Worst part...this is the C assignment and it's driving me crazy. I do recall the list fuction. But isn't it imperative that I have the index of the spaces in the string name? I use the Fullname.isspace function.
[toc] | [prev] | [next] | [standalone]
| From | "Joseph Lee" <joseph.lee22590@gmail.com> |
|---|---|
| Date | 2015-07-16 20:12 -0700 |
| Message-ID | <mailman.623.1437102763.3674.python-list@python.org> |
| In reply to | #93980 |
Hi Craig: -----Original Message----- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail.com@python.org] On Behalf Of craig.sirna@gmail.com Sent: Thursday, July 16, 2015 8:01 PM To: python-list@python.org Subject: Re: Need assistance >I am in bed, on my phone, gotta be up in 4 hours for work. I will get back with you guys tomorrow after I take care of my Math class stuff. I need to step away from this for a day lol. JL: Please rest well (you don't want to have a headache all night). >Worst part...this is the C assignment and it's driving me crazy. >I do recall the list fuction. But isn't it imperative that I have the index of the spaces in the string name? >I use the Fullname.isspace function. JL: No. Michael's hint lets you turn a string into a list. Good luck. Cheers, Joseph -- https://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | "Joseph Lee" <joseph.lee22590@gmail.com> |
|---|---|
| Date | 2015-07-16 19:44 -0700 |
| Message-ID | <mailman.620.1437101104.3674.python-list@python.org> |
| In reply to | #93975 |
Hi Michael,
I have talked to this guy offlist (basically you gave him the answer
(smiles)).
Cheers,
Joseph
-----Original Message-----
From: Python-list
[mailto:python-list-bounces+joseph.lee22590=gmail.com@python.org] On Behalf
Of Michael Torrie
Sent: Thursday, July 16, 2015 7:41 PM
To: python-list@python.org
Subject: Re: Need assistance
On 07/16/2015 08:15 PM, craig.sirna@gmail.com wrote:
> I need help writing a homework program.
>
> I'll write it, but I can't figure out how to incorporate what I have
> read in the book to work in code.
Can you post the code that you are currently working with?
> 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.
>
> I tried to use the search function in Python to locate any spaces in
> the input. It spot back the index 5 (I used Craig Daniel Sirna)
Which search function are you talking about? Is it a string method or
something else?
One of the first string methods I learned about when I first started with
Python was the .split() method. For example, in the interactive shell try
this:
>>> a="one,two,three"
>>> a.split(',')
Does this help at all?
> That is correct for the first space, but I can't figure out how to get
> it to continue to the next space.
> The indexing process is also a bit confusingto me.
Which part of indexing is confusing? The syntax for slicing? I admit I
sometimes find it a bit complicated to know when and where to use -1 as the
index.
> I get that I can use len(fullName) to set the length of the index, and
> how the index is counted, but after that I'm lost.
>
> I have emailed my professor a few times, but haven't gotten a
> response.(online course)
>
> Any help would be greatly appreciated.
Again, show us the code you have so far and maybe we can help you figure it
out.
--
https://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Date | 2015-07-16 21:00 -0600 |
| Message-ID | <mailman.621.1437102051.3674.python-list@python.org> |
| In reply to | #93975 |
On 07/16/2015 08:44 PM, Joseph Lee wrote: > Hi Michael, > I have talked to this guy offlist (basically you gave him the answer > (smiles)). > Cheers, > Joseph Sounds good. I had hoped to merely point him in the right way, and that he would put things together. I hope this is indeed the case.
[toc] | [prev] | [next] | [standalone]
| From | Rob Gaddi <rgaddi@technologyhighland.invalid> |
|---|---|
| Date | 2015-07-17 16:40 +0000 |
| Message-ID | <mobb5r$srh$1@dont-email.me> |
| In reply to | #93975 |
On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:
> I need help writing a homework program.
>
> I'll write it, but I can't figure out how to incorporate what I have
> read in the book to work in code.
>
> 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.
>
> I tried to use the search function in Python to locate any spaces in the
> input. It spot back the index 5 (I used Craig Daniel Sirna)
>
> That is correct for the first space, but I can't figure out how to get
> it to continue to the next space.
>
> The indexing process is also a bit confusingto me.
>
> I get that I can use len(fullName) to set the length of the index, and
> how the index is counted, but after that I'm lost.
>
> I have emailed my professor a few times, but haven't gotten a
> response.(online course)
>
> Any help would be greatly appreciated.
1) Use the interactive console. Set x = 'Craig Daniel Sirna' and play
with indexing and slicing it until you really internalize what they
mean. x[3], x[-3], x[0:10], x[0:-1]. It's not actually relevant to the
problem at hand, but right now is the time in your education to get
indexing down cold; skimp on it now and you'll pay for it forever.
Should take you about 5 minutes.
2) https://docs.python.org/3/library/stdtypes.html#string-methods
You can do what you're trying to do, but you're swinging a hammer with a
powered nailgun at your feet. Search is an inefficient way to try to
split a string into parts based on a delimiter.
--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order. See above to fix.
[toc] | [prev] | [next] | [standalone]
| From | Igor Korot <ikorot01@gmail.com> |
|---|---|
| Date | 2015-07-17 12:54 -0400 |
| Message-ID | <mailman.651.1437152048.3674.python-list@python.org> |
| In reply to | #94015 |
Hi, Rob,
On Fri, Jul 17, 2015 at 12:40 PM, Rob Gaddi
<rgaddi@technologyhighland.invalid> wrote:
> On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:
>
>> I need help writing a homework program.
>>
>> I'll write it, but I can't figure out how to incorporate what I have
>> read in the book to work in code.
>>
>> 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.
>>
>> I tried to use the search function in Python to locate any spaces in the
>> input. It spot back the index 5 (I used Craig Daniel Sirna)
>>
>> That is correct for the first space, but I can't figure out how to get
>> it to continue to the next space.
>>
>> The indexing process is also a bit confusingto me.
>>
>> I get that I can use len(fullName) to set the length of the index, and
>> how the index is counted, but after that I'm lost.
>>
>> I have emailed my professor a few times, but haven't gotten a
>> response.(online course)
>>
>> Any help would be greatly appreciated.
>
> 1) Use the interactive console. Set x = 'Craig Daniel Sirna' and play
> with indexing and slicing it until you really internalize what they
> mean. x[3], x[-3], x[0:10], x[0:-1]. It's not actually relevant to the
> problem at hand, but right now is the time in your education to get
> indexing down cold; skimp on it now and you'll pay for it forever.
> Should take you about 5 minutes.
>
> 2) https://docs.python.org/3/library/stdtypes.html#string-methods
> You can do what you're trying to do, but you're swinging a hammer with a
> powered nailgun at your feet. Search is an inefficient way to try to
> split a string into parts based on a delimiter.
Most likely it's not him. They will learn it later during the course. ;-)
>
> --
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order. See above to fix.
> --
> https://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-07-17 20:00 +0100 |
| Message-ID | <mailman.655.1437159662.3674.python-list@python.org> |
| In reply to | #94015 |
On 17/07/2015 17:40, Rob Gaddi wrote:
> On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:
>
>> I need help writing a homework program.
>>
>> I'll write it, but I can't figure out how to incorporate what I have
>> read in the book to work in code.
>>
>> 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.
>>
>> I tried to use the search function in Python to locate any spaces in the
>> input. It spot back the index 5 (I used Craig Daniel Sirna)
>>
>> That is correct for the first space, but I can't figure out how to get
>> it to continue to the next space.
>>
>> The indexing process is also a bit confusingto me.
>>
>> I get that I can use len(fullName) to set the length of the index, and
>> how the index is counted, but after that I'm lost.
>>
>> I have emailed my professor a few times, but haven't gotten a
>> response.(online course)
>>
>> Any help would be greatly appreciated.
>
> 1) Use the interactive console. Set x = 'Craig Daniel Sirna' and play
> with indexing and slicing it until you really internalize what they
> mean. x[3], x[-3], x[0:10], x[0:-1]. It's not actually relevant to the
> problem at hand, but right now is the time in your education to get
> indexing down cold; skimp on it now and you'll pay for it forever.
> Should take you about 5 minutes.
I'll throw in something to emphasize a major difference between indexing
and slicing.
>>> x = 'Craig Daniel Sirna'
>>> x[100]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> x[100:]
''
>>> x[:100]
'Craig Daniel Sirna'
>
> 2) https://docs.python.org/3/library/stdtypes.html#string-methods
> You can do what you're trying to do, but you're swinging a hammer with a
> powered nailgun at your feet. Search is an inefficient way to try to
> split a string into parts based on a delimiter.
>
Inefficient I don't know about, and mostly don't care about either, but
certainly not the cleanest way to code, at least IMHO.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2015-07-18 00:40 +0000 |
| Message-ID | <moc7aa$geg$1@dont-email.me> |
| In reply to | #93975 |
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).
Note - reversed returns an iterable, list will convert the iterable to a
list.
To join the elements of a list into a string, see the join method of
strings.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Sibylle Koczian <nulla.epistola@web.de> |
|---|---|
| Date | 2015-07-18 12:35 +0200 |
| Message-ID | <mailman.675.1437215723.3674.python-list@python.org> |
| In reply to | #94043 |
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.)
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2015-07-19 00:59 +0000 |
| Message-ID | <moesp6$e2m$1@dont-email.me> |
| In reply to | #94053 |
On Sat, 18 Jul 2015 12:35:10 +0200, Sibylle Koczian wrote: > Am 18.07.2015 um 02:40 schrieb Denis McMahon: >> 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. Oh, then it's even easier, yes, it's mainly a case of list indexing. 1) Split the original string into a list of words (string.split() method) 2) create a sublist (s1) of the last element 3) create another sublist (s2) of the first to penultimate elements 4) combine the two sublists 5) use the string.join() method to combine the sublist elements into a single string I think most pythonistas would probably combine steps 2 through 4 in a single line of code, possibly even steps 2 through 5. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2015-07-19 17:35 +0100 |
| Message-ID | <mailman.724.1437323706.3674.python-list@python.org> |
| In reply to | #94079 |
On 2015-07-19 01:59, Denis McMahon wrote: > On Sat, 18 Jul 2015 12:35:10 +0200, Sibylle Koczian wrote: > >> Am 18.07.2015 um 02:40 schrieb Denis McMahon: > >>> 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. > > Oh, then it's even easier, yes, it's mainly a case of list indexing. > > 1) Split the original string into a list of words (string.split() method) > 2) create a sublist (s1) of the last element > 3) create another sublist (s2) of the first to penultimate elements > 4) combine the two sublists > 5) use the string.join() method to combine the sublist elements into a > single string > > I think most pythonistas would probably combine steps 2 through 4 in a > single line of code, possibly even steps 2 through 5. > If you use rsplit, you can do it in one line.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2015-07-19 18:06 +0000 |
| Subject | flipping string order |
| Message-ID | <mogov0$ttt$1@dont-email.me> |
| In reply to | #94130 |
On Sun, 19 Jul 2015 17:35:03 +0100, MRAB wrote:
> rsplit -> one line.
def lastWordFirst(s):
return " ".join(reversed(s.rsplit(" ", 1)))
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Date | 2015-07-18 14:16 +0200 |
| Message-ID | <mailman.677.1437221782.3674.python-list@python.org> |
| In reply to | #94043 |
You don't have to index them. You can unpack them into a tuple of first, middle, last Laura (who is trying not to do somebody's homework for them, since I'm not the person who needs to learn this).
[toc] | [prev] | [next] | [standalone]
| From | "Joseph Lee" <joseph.lee22590@gmail.com> |
|---|---|
| Date | 2015-07-18 09:05 -0700 |
| Message-ID | <mailman.678.1437235575.3674.python-list@python.org> |
| In reply to | #94043 |
Hi Laura, There are edge cases where this may fail (and let's see if Craig catches this on his own). Cheers, Joseph -----Original Message----- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail.com@python.org] On Behalf Of Laura Creighton Sent: Saturday, July 18, 2015 5:16 AM To: Sibylle Koczian <nulla.epistola@web.de> Cc: python-list@python.org; lac@openend.se Subject: Re: Need assistance You don't have to index them. You can unpack them into a tuple of first, middle, last Laura (who is trying not to do somebody's homework for them, since I'm not the person who needs to learn this). -- https://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2015-07-18 12:18 -0400 |
| Message-ID | <mailman.679.1437236313.3674.python-list@python.org> |
| In reply to | #94043 |
On Sat, 18 Jul 2015 14:16:11 +0200, Laura Creighton <lac@openend.se>
declaimed the following:
>You don't have to index them. You can unpack them into a tuple
>of first, middle, last
>
>Laura (who is trying not to do somebody's homework for them, since
>I'm not the person who needs to learn this).
That only works if the input IS three names (My Birth Certificate reads
"Dennis Lee James Bieber"; and I often used to include my confirmation name
into the thing; I've grown out of that phase but do still sometimes use
dljjb as initials).
Simple .split() and a {HP calculator} roll operation should get the
desired order.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-07-18 18:34 +0100 |
| Message-ID | <mailman.680.1437240865.3674.python-list@python.org> |
| In reply to | #94043 |
On 18/07/2015 17:18, Dennis Lee Bieber wrote:
> On Sat, 18 Jul 2015 14:16:11 +0200, Laura Creighton <lac@openend.se>
> declaimed the following:
>
>> You don't have to index them. You can unpack them into a tuple
>> of first, middle, last
>>
>> Laura (who is trying not to do somebody's homework for them, since
>> I'm not the person who needs to learn this).
>
> That only works if the input IS three names (My Birth Certificate reads
> "Dennis Lee James Bieber"; and I often used to include my confirmation name
> into the thing; I've grown out of that phase but do still sometimes use
> dljjb as initials).
This https://www.python.org/dev/peps/pep-3132/ might be handy in this case.
>
> Simple .split() and a {HP calculator} roll operation should get the
> desired order.
>
What is an {HP calculator} roll operation?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | mm0fmf <none@mailinator.com> |
|---|---|
| Date | 2015-07-18 19:51 +0100 |
| Message-ID | <pexqx.5711$2z2.879@fx04.am4> |
| In reply to | #94057 |
On 18/07/2015 18:34, Mark Lawrence wrote:
>
> What is an {HP calculator} roll operation?
HP calculators were proper in that they used RPN entry.
i.e. 2 enter 2 + would show 4 instead of 2 + 2 =
Gawd it's so long but ISTR there were 3 stack registers and the display.
So you could press
1 enter
2 enter
3 enter
4
and Z = 1, Y = 2, X = 3 and display = 4. Roll would rotate the entries
through the display register.
ROLL and Z = 2, Y = 3, X = 4 and display = 1
and so on. There was an INV ROLL to go the other way.
The 3 level stack was equivalent to nesting parentheses three times. I
only had a TI-59 as it was half the price of an HP67. The TI had more
memories and program steps and was faster. But it didn't say HP on the
front!
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2015-07-18 15:10 -0400 |
| Message-ID | <mailman.681.1437246657.3674.python-list@python.org> |
| In reply to | #94058 |
On Sat, Jul 18, 2015 at 2:51 PM, mm0fmf via Python-list
<python-list@python.org> wrote:
> On 18/07/2015 18:34, Mark Lawrence wrote:
>>
>>
>> What is an {HP calculator} roll operation?
>
>
> HP calculators were proper in that they used RPN entry.
>
> i.e. 2 enter 2 + would show 4 instead of 2 + 2 =
>
> Gawd it's so long but ISTR there were 3 stack registers and the display. So
> you could press
>
> 1 enter
> 2 enter
> 3 enter
> 4
>
> and Z = 1, Y = 2, X = 3 and display = 4. Roll would rotate the entries
> through the display register.
>
> ROLL and Z = 2, Y = 3, X = 4 and display = 1
>
> and so on. There was an INV ROLL to go the other way.
>
> The 3 level stack was equivalent to nesting parentheses three times. I only
> had a TI-59 as it was half the price of an HP67. The TI had more memories
> and program steps and was faster. But it didn't say HP on the front!
>
I have an hp35. But to be 'really' cool you have to have an hp35 that
just says hp. Those were the very first ones
--
Joel Goldstick
http://joelgoldstick.com
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web