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
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
>
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
_
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
> -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
> -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
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
> -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
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
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
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
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
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
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
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_
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
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
17 matches
Mail list logo