Re: Is there a conflict of libraries here?

2020-11-08 Thread Chris Angelico
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

Re: Is there a conflict of libraries here?

2020-11-08 Thread Terry Reedy
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

Re: returning totals in functions of math

2020-11-08 Thread inhahe
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 +=

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
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

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
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

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
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

Re: answer not correct

2020-11-08 Thread MRAB
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

Re: answer not correct

2020-11-08 Thread Ivan "Rambius" Ivanov
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 > *

Re: returning totals in functions of math

2020-11-08 Thread Quentin Bock
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

Re: returning totals in functions of math

2020-11-08 Thread 2QdxY4RzWzUUiLuE
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(

answer not correct

2020-11-08 Thread Quentin Bock
*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

Re: returning totals in functions of math

2020-11-08 Thread Peter Pearson
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

returning totals in functions of math

2020-11-08 Thread Quentin Bock
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

Re: Is there a conflict of libraries here?

2020-11-08 Thread Richard Damon
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

Re: Is there a conflict of libraries here?

2020-11-08 Thread Chris Angelico
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.

Re: Is there a conflict of libraries here?

2020-11-08 Thread SMOA BLX via Python-list
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

Re: Is there a conflict of libraries here?

2020-11-08 Thread Terry Reedy
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

Re: Questions about XML processing?

2020-11-08 Thread Hernán De Angelis
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

Re: Is there a conflict of libraries here?

2020-11-08 Thread Cameron Simpson
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