Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93975 > unrolled thread

Need assistance

Started bycraig.sirna@gmail.com
First post2015-07-16 19:15 -0700
Last post2015-07-20 15:25 +1000
Articles 11 on this page of 31 — 16 participants

Back to article view | Back to comp.lang.python


Contents

  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 2 of 2 — ← Prev page 1 [2]


#94060

Frommm0fmf <none@mailinator.com>
Date2015-07-18 20:35 +0100
Message-ID<nUxqx.14487$Ie6.210@fx43.am4>
In reply to#94059
On 18/07/2015 20:10, Joel Goldstick wrote:
> 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
>
I want a real HP16C and have been tempted to buy one from eBay.

[toc] | [prev] | [next] | [standalone]


#94063

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-07-18 17:44 -0400
Message-ID<mailman.683.1437255851.3674.python-list@python.org>
In reply to#94058
On Sat, 18 Jul 2015 19:51:00 +0100, mm0fmf via Python-list
<python-list@python.org> declaimed the following:

>
>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
>
	Four: T, Z, Y, X

	T would duplicate as the stack dropped. X was the display after
operations (during data entry it was hidden)

>
>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!

	The new units (HP28, 48, 49, 50, etc.) no longer use the 4-register
stack; the stack is whatever is available in memory. As a result, the Roll
instructions now need an argument for how many stack entries are in play.

	The HP50g has a bit of a sluggish response compared to the 48sx [which
is not equivalent to a 48g]. Might be since the 48sx is still a SATURN
hardware processor. The 50g is an underclocked (for battery life) ARM,
running a SATURN emulator, with the emulator running the RPL/RPN user
interface (there are packages that let one program in SYSRPL [which
bypasses all the user level data checks, so if one knows the data on the
stack is good, one can speed up subsequent operations], SATURN assembly,
AND ARM assembly).

	For $20 or so one can get the HP Prime as an Android app.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#94084

FromMichael Torrie <torriem@gmail.com>
Date2015-07-18 20:46 -0600
Message-ID<mailman.696.1437273990.3674.python-list@python.org>
In reply to#94058
On 07/18/2015 03:44 PM, Dennis Lee Bieber wrote:
> 	The new units (HP28, 48, 49, 50, etc.) no longer use the 4-register
> stack; the stack is whatever is available in memory. As a result, the Roll
> instructions now need an argument for how many stack entries are in play.
> 
> 	The HP50g has a bit of a sluggish response compared to the 48sx [which
> is not equivalent to a 48g]. Might be since the 48sx is still a SATURN
> hardware processor. The 50g is an underclocked (for battery life) ARM,
> running a SATURN emulator, with the emulator running the RPL/RPN user
> interface (there are packages that let one program in SYSRPL [which
> bypasses all the user level data checks, so if one knows the data on the
> stack is good, one can speed up subsequent operations], SATURN assembly,
> AND ARM assembly).
> 
> 	For $20 or so one can get the HP Prime as an Android app.

My list of must-have android apps on my phone and tablet include
Droid48, which is an android port of X48.  Runs the original firmware
and everything.  Works very well for me.  Of course I also use my real
HP 48 on regular basis.  The poor thing is 20 years old now but still
the most useful calculator I've ever owned.  I get lost on calculators
without a stack and RPN.  Had a debate with m boss over RPN though.  He
claimed it was just HP's engineers being lazy.  For me RPN on a stack is
faster for me than a normal calculator because it's closer to how my
brain does math--you have to manually do order of operations on paper.

Just the other day I learned how to implement custom units on my hp 48
and have them automatically convert to other units.  Very cool.

[toc] | [prev] | [next] | [standalone]


#94062

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-07-18 17:34 -0400
Message-ID<mailman.682.1437255298.3674.python-list@python.org>
In reply to#94043
On Sat, 18 Jul 2015 18:34:04 +0100, Mark Lawrence <breamoreboy@yahoo.co.uk>
declaimed the following:

>
>What is an {HP calculator} roll operation?

	An attempt to not provide all the answers directly.

	Specify number of items on calculator stack;
	Specify roll-up or roll-down (I always have to check which one I want) 

Stack:
a
b
c
d
4 roll (command entry)

gives

Stack:
b
c
d
a

(or d, a, b, c depending on up or down)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#94070

FromWilliam Ray Wing <wrw@mac.com>
Date2015-07-18 14:28 -0400
Message-ID<mailman.684.1437262501.3674.python-list@python.org>
In reply to#94043
> On Jul 18, 2015, at 1:34 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> 
> 

[byte]

> What is an {HP calculator} roll operation?
> 

The original Hewlett Packard “Scientific” calculators (HP-35, 45, 65, etc) that used Polish notation (operand, operand, operation; with no “=“ sign) had a stack.  That stack itself could be manipulated (e.g., interchange X and Y). One of the stack manipulation commands was “Roll” which moved the top entry into X and pushed remaining elements up one.  Later versions had both Roll-up and Roll-down, Roll-down moved the X entry to the top of the stack and dropped the other elements.

Bill  (Who still uses an HP-45 emulator on his iPhone)

> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#94074

FromMRAB <python@mrabarnett.plus.com>
Date2015-07-19 01:14 +0100
Message-ID<mailman.688.1437264896.3674.python-list@python.org>
In reply to#94043
On 2015-07-18 19:28, William Ray Wing wrote:
>
>> On Jul 18, 2015, at 1:34 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>>
>>
>
> [byte]
>
>> What is an {HP calculator} roll operation?
>>
>
> The original Hewlett Packard “Scientific” calculators (HP-35, 45, 65, etc) that used Polish notation (operand, operand, operation; with no “=“ sign) had a stack.

FYI, Polish Notation is a prefix notation; the operation comes first.

What you're talking about is Reverse Polish Notation, where the
operation comes last.

 > That stack itself could be manipulated (e.g., interchange X and Y). 
One of the stack manipulation commands was “Roll” which moved the top 
entry into X and pushed remaining elements up one.  Later versions had 
both Roll-up and Roll-down, Roll-down moved the X entry to the top of 
the stack and dropped the other elements.
>
> Bill  (Who still uses an HP-45 emulator on his iPhone)
>

[toc] | [prev] | [next] | [standalone]


#94174

Fromcraig.sirna@gmail.com
Date2015-07-19 16:06 -0700
Message-ID<99ad55c0-0c1c-4442-9db7-c762f17cde04@googlegroups.com>
In reply to#93975
On Thursday, July 16, 2015 at 9:16:01 PM UTC-5, craig...@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.
> 
> 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.



def main():
    name= input('Enter your full name: ')
    split=name.split()
    Full_name=split[2],split[0], split[1]
    print(Full_name[2],',', Full_name[0], Full_name[1])
    
main()

Sorry it took so long to get back to you guys and I greatly appreciate all the help!!! 

But I just did it now and it does work. I have been working on my College algebra homework for the past week and I am still not even finished or ready for the test....fml....

[toc] | [prev] | [next] | [standalone]


#94178

FromMichael Torrie <torriem@gmail.com>
Date2015-07-19 17:56 -0600
Message-ID<mailman.752.1437350191.3674.python-list@python.org>
In reply to#94174
On 07/19/2015 05:06 PM, craig.sirna@gmail.com wrote:
> def main(): name= input('Enter your full name: ') 
>     split=name.split()
>     Full_name=split[2],split[0], split[1] 
>     print(Full_name[2],',', Full_name[0], Full_name[1])
> 
> main()
> 
> Sorry it took so long to get back to you guys and I greatly
> appreciate all the help!!!
> 
> But I just did it now and it does work. I have been working on my
> College algebra homework for the past week and I am still not even
> finished or ready for the test....fml....

Now do you understand why it works and how?  For example, if I said that
the "full_name=...." line is redundant, do you understand why?

[toc] | [prev] | [next] | [standalone]


#94179

FromRick Johnson <rantingrickjohnson@gmail.com>
Date2015-07-19 17:21 -0700
Message-ID<219b1f31-d34f-4ec2-846c-96ddd7170058@googlegroups.com>
In reply to#94174
On Sunday, July 19, 2015 at 6:07:14 PM UTC-5, craig...@gmail.com wrote: 
> def main():
>     name= input('Enter your full name: ')
>     split=name.split()
>     Full_name=split[2],split[0], split[1]
>     print(Full_name[2],',', Full_name[0], Full_name[1])
>     
> main()

Sorry, but this code is no where near done yet. What happens
when the user enters invalid input? *BANG*
        
> split=name.split()

Unpacking those variables would be wiser, and syntactically
cleaner, than storing them behind a single variable. And 
split is a horrible symbol choice. first, middle, and last 
would be more descriptive.

> Full_name=split[2],split[0], split[1]
> print(Full_name[2],',', Full_name[0], Full_name[1])

Yuck. Too noisy. Always try to keep indexing to a minimum.
And never, ever, repeat yourself.

    VALIDATE_YOUR_INPUT + REMOVE_THE_NOISE = A+
    
    EXTRA_CREDIT: Repeatedly ask for input until validation passes.

    EXTRA_EXTRA_CREDIT: Allow clean exit if the user declines input.

[toc] | [prev] | [next] | [standalone]


#94206

FromMichael Torrie <torriem@gmail.com>
Date2015-07-19 23:16 -0600
Message-ID<mailman.762.1437369426.3674.python-list@python.org>
In reply to#94179
On 07/19/2015 06:21 PM, Rick Johnson wrote:
> On Sunday, July 19, 2015 at 6:07:14 PM UTC-5, craig...@gmail.com wrote: 
>> def main():
>>     name= input('Enter your full name: ')
>>     split=name.split()
>>     Full_name=split[2],split[0], split[1]
>>     print(Full_name[2],',', Full_name[0], Full_name[1])
>>     
>> main()
> 
> Sorry, but this code is no where near done yet. What happens
> when the user enters invalid input? *BANG*

Give the guy a break. He's just barely been exposed to Python and he's
simply trying to fulfill the assignment's requirements.  Nothing more.
Judge the professor and course all you want.  But for a 100 level course
just getting people to get any sort of input is a challenge.  Once he's
mastered that, then he can learn about input validation.  You're
probably someone who can't remember ever not knowing how to program.
But most people aren't like that.  Got to learn a little bit at a time,
even if it's dangerous at the very first. It's not like he's going to be
expected to hack kernel code for his next assignment.

[toc] | [prev] | [next] | [standalone]


#94207

FromChris Angelico <rosuav@gmail.com>
Date2015-07-20 15:25 +1000
Message-ID<mailman.763.1437369933.3674.python-list@python.org>
In reply to#94179
On Mon, Jul 20, 2015 at 3:16 PM, Michael Torrie <torriem@gmail.com> wrote:
> On 07/19/2015 06:21 PM, Rick Johnson wrote:
>> On Sunday, July 19, 2015 at 6:07:14 PM UTC-5, craig...@gmail.com wrote:
>>> def main():
>>>     name= input('Enter your full name: ')
>>>     split=name.split()
>>>     Full_name=split[2],split[0], split[1]
>>>     print(Full_name[2],',', Full_name[0], Full_name[1])
>>>
>>> main()
>>
>> Sorry, but this code is no where near done yet. What happens
>> when the user enters invalid input? *BANG*
>
> Give the guy a break. He's just barely been exposed to Python and he's
> simply trying to fulfill the assignment's requirements.  Nothing more.
> Judge the professor and course all you want.  But for a 100 level course
> just getting people to get any sort of input is a challenge.  Once he's
> mastered that, then he can learn about input validation.  You're
> probably someone who can't remember ever not knowing how to program.
> But most people aren't like that.  Got to learn a little bit at a time,
> even if it's dangerous at the very first. It's not like he's going to be
> expected to hack kernel code for his next assignment.

Rick's idea of scope creep probably *does* include kernel hacking as
part of Arithmetic 101.

ChrisA

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web