On 07Nov2020 22:57, Steve wrote:
>Ok, the light just went out.
>I thought I was getting something, but no...
>
>I will keep on reading, maybe it will hatch.
You're probably overthinking this. I'll address your new example below.
First up: numbers are objects, strings are objects, classes are obj
On 2020-11-07 20:03, Dieter Maurer wrote:
Hernán De Angelis wrote at 2020-11-6 21:54 +0100:
...
However, the hard thing to do here is to get those only when
tagC/note/title/string='value'. I was expecting to find a way of
specifying a certain construction in square brackets, like
[@string='valu
On 11/6/2020 5:05 PM, Steve wrote:
"Right, because the name "datetime" points to the class datetime in the
module datetime.
A module containing an object with the same name as the module is a real
pain, a constant mental papercut. I consider datetime.datetime to be a
design mistake*. You ar
ha! ha! 2 empowering___
we make it.
__
+44 1635 887711 On Sunday, November 8, 2020, 01:06:03 a.m. PST, Cameron
Simpson wrote:
On 07Nov2020 22:57, Steve wrote:
>Ok, the light just went out.
>I thought I was getting something, but no...
>
>I will keep on
On Mon, Nov 9, 2020 at 1:11 AM Terry Reedy wrote:
>
> On 11/6/2020 5:05 PM, Steve wrote:
> > "Right, because the name "datetime" points to the class datetime in the
> > module datetime.
>
> A module containing an object with the same name as the module is a real
> pain, a constant mental papercut.
On 11/7/20 9:26 PM, Terry Reedy wrote:
> On 11/6/2020 5:05 PM, Steve wrote:
>> "Right, because the name "datetime" points to the class datetime in the
>> module datetime.
>
> A module containing an object with the same name as the module is a
> real pain, a constant mental papercut. I consider dat
Errors say that add takes 1 positional argument but 3 were given? Does this
limit how many numbers I can have or do I need other variables?
Here is what I have:
def add(numbers):
total = 1
for x in numbers:
total += x
return total
print(add(1999, -672, 84))
I have a multiply fun
On Sun, 8 Nov 2020 13:50:19 -0500, Quentin Bock wrote:
> Errors say that add takes 1 positional argument but 3 were given? Does this
> limit how many numbers I can have or do I need other variables?
> Here is what I have:
> def add(numbers):
>total = 1
>for x in numbers:
> total
*def add(numbers):*
* total = 1*
* for x in numbers:*
* total += 1*
* return total*
*print(add[1999, -672, 64]))*
*the answer I get is 4 but it should be 1,411*
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-11-08 at 19:00:34 +,
Peter Pearson wrote:
> On Sun, 8 Nov 2020 13:50:19 -0500, Quentin Bock wrote:
> > Errors say that add takes 1 positional argument but 3 were given? Does this
> > limit how many numbers I can have or do I need other variables?
> > Here is what I have:
> > def add(
Ok, I don't know how to change add to accept an arbitrary number of
arguments (I'm pretty new) and as for total = 1 idk but it worked for other
versions of this (multiplication), and figured it might work for this one,
do you have any tips on what a better number might be for the total to
equal?
O
Hello,
First of all, remove the asterisks around the snippet, it makes it so
hard to copy and paste your code. My answer is inlined.
On Sun, Nov 8, 2020 at 2:28 PM Quentin Bock wrote:
>
> *def add(numbers):*
> * total = 1*
If this is your sum, you need to initialize it to zero:
total = 0
> *
On 2020-11-08 19:25, Quentin Bock wrote:
*def add(numbers):*
* total = 1*
* for x in numbers:*
* total += 1*
* return total*
*print(add[1999, -672, 64]))*
*the answer I get is 4 but it should be 1,411*
1. You typed "total += 1", which means it's adding 1 each time around
the loo
On 09/11/2020 08:47, Quentin Bock wrote:
Ok, I don't know how to change add to accept an arbitrary number of
arguments (I'm pretty new) and as for total = 1 idk but it worked for other
versions of this (multiplication), and figured it might work for this one,
do you have any tips on what a better
Comments interposed:-
On 09/11/2020 08:14, 2qdxy4rzwzuui...@potatochowder.com wrote:
On 2020-11-08 at 19:00:34 +,
Peter Pearson wrote:
On Sun, 8 Nov 2020 13:50:19 -0500, Quentin Bock wrote:
Errors say that add takes 1 positional argument but 3 were given? Does this
limit how many number
On 09/11/2020 09:41, Quentin Bock wrote:
Okay, thank you :) I didn't understand about 90% of what you explained
lol (sorry) but the sum worked and I have the correct answer. Also, do
you know any numbers that could replace 1 in this function as the total?
just curious
Thanks :)
Yes, apologi
On Sun, Nov 8, 2020 at 1:51 PM Quentin Bock wrote:
> Errors say that add takes 1 positional argument but 3 were given? Does this
> limit how many numbers I can have or do I need other variables?
> Here is what I have:
> def add(numbers):
>total = 1
>for x in numbers:
> total +=
On 11/8/2020 9:56 AM, Chris Angelico wrote:
On Mon, Nov 9, 2020 at 1:11 AM Terry Reedy wrote:
A module containing an object with the same name as the module is a real
pain, a constant mental papercut. I consider datetime.datetime to be a
design mistake*. You are the 2nd person in about a mo
On Mon, Nov 9, 2020 at 3:32 PM Terry Reedy wrote:
>
> On 11/8/2020 9:56 AM, Chris Angelico wrote:
> > On Mon, Nov 9, 2020 at 1:11 AM Terry Reedy wrote:
>
> >> A module containing an object with the same name as the module is a real
> >> pain, a constant mental papercut. I consider datetime.datet
19 matches
Mail list logo