Re: [Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread Steven D'Aprano
On Wed, Aug 12, 2015 at 12:14:16PM -0700, D Wyatt wrote: > > > pow(-3, 2) > > 9 > > > > I'm explicitly telling Python I want the value -3 raised > > to the power 2. > > > > > > Alan G > > so passing any numeric expression in a function is like putting () > around it, correct? Hmmm. I suppose

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Alan Gauld
On 12/08/15 18:54, Clayton Kirkwood wrote: If I understand your 'question', your code *should* reduce to this for the given filename: Now, what is your expected output? And what are you getting? I'm not sure I understand what Question 2 actually is... Given the data provided one could

Re: [Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread D Wyatt
> pow(-3, 2) > 9 > > I'm explicitly telling Python I want the value -3 raised > to the power 2. > > > Alan G so passing any numeric expression in a function is like putting () around it, correct? Thank you for demoderating me :). -- Deb Wyatt in WA _

Re: [Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread Válas Péter
2015-08-12 18:07 GMT+02:00 D Wyatt : > so I 'get' that -5**2 = -25 and (-5)**2 is 25, BUT if you write a function > > and pass it a negative number it handles it as though the argument is > in parentheses. > As the argument IS in parentheses. How do you pass it to the function without parentheses

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Steven D'Aprano > Sent: Wednesday, August 12, 2015 6:43 AM > To: tutor@python.org > Subject: Re: [Tutor] a few question about my evolving program > > On Tue, Aug 11, 2015 at 08:23:00PM

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Alan Gauld > Sent: Wednesday, August 12, 2015 2:41 AM > To: tutor@python.org > Subject: Re: [Tutor] a few question about my evolving program > > On 12/08/15 04:23, Clayton Kirkwood wrot

Re: [Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread Emile van Sebille
On 8/12/2015 9:07 AM, D Wyatt wrote: so I 'get' that -5**2 = -25 and (-5)**2 is 25, BUT if you write a function def sq(x): """ Output: sq returns the square of its input input x: a number (int or float) """ return x**2 and pass it a negative number it handles it as though the ar

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Peter Otten > Sent: Wednesday, August 12, 2015 2:22 AM > To: tutor@python.org > Subject: Re: [Tutor] a few question about my evolving program > > Clayton Kirkwood wrote: > > > > Look

Re: [Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread Alan Gauld
On 12/08/15 17:07, D Wyatt wrote: so I 'get' that -5**2 = -25 and (-5)**2 is 25, BUT if you write a function def sq(x): """ Output: sq returns the square of its input input x: a number (int or float) """ return x**2 and pass it a negative number it handles it as though the argum

[Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread D Wyatt
so I 'get' that -5**2 = -25 and (-5)**2 is 25, BUT if you write a function def sq(x): """ Output: sq returns the square of its input input x: a number (int or float) """ return x**2 and pass it a negative number it handles it as though the argument is in parentheses. I find this conf

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Steven D'Aprano
On Tue, Aug 11, 2015 at 08:23:00PM -0700, Clayton Kirkwood wrote: > Question 2: > My current code: > See "Look here" below. There's an art to picking good variable names, neither too short nor too long, just descriptive enough without being too verbose. Or to put it another way... The existe

Re: [Tutor] AttributeError,

2015-08-12 Thread Ltc Hotspot
Hi Steven, Message heard loud and clear: Question: What sorted function should I write to produce the desired output, below: Desired output: 04 3 06 1 07 1 09 2 10 3 11 6 14 1 15 2 16 4 17 2 18 1 19 1 Latest revised code: count = dict() fname = raw_input("Enter file name: ")# handle = open (f

Re: [Tutor] Writing back to same CSV in the next column

2015-08-12 Thread Nym City via Tutor
Hello, Please find the two requested files attached. The 'before' file is what I am reading into my program. The 'after' file is what I would like to have my output to look like. Ideally, I want it to be the same file but if its easier to create a new file for the output - that is ok too.  I do

Re: [Tutor] AttributeError,

2015-08-12 Thread Ltc Hotspot
Steven, Visit the URL links below to view the latest revised code: Output: 09:14:16 Syntax message: val is not defined Raw data code, available at http://tinyurl.com/ob89r9p Embedded data code, available at http://tinyurl.com/qhm4ppq Visualization URL link, available at http://tinyurl.com/ozzmff

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Alan Gauld
On 12/08/15 04:23, Clayton Kirkwood wrote: Question 2: My current code: See "Look here" below. If I understand your 'question', your code *should* reduce to this for the given filename: ... target_directory_file_list = master_directory_file_list[target_directory] ... for current_directory_

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Peter Otten
Clayton Kirkwood wrote: > Look here: After some clean-up: > if current_filename in target_directory_file_list: >current_stat_info = os.stat( >current_directory_path + '/' + current_filename, >follow_symlinks=False) >current_file_size = current_stat_in

Re: [Tutor] a few question about my evolving program

2015-08-12 Thread Cameron Simpson
On 11Aug2015 22:33, Clayton Kirkwood wrote: >What is the purpose and how is the following definition focused on the *? >Turns out, you can't actually put the asterisk in the code, so what >does it mean? >os.stat(path, *, dir_fd=None, follow_symlinks=True) [...] Python function definition syntax