RE: on writing a while loop for rolling two dice

2021-08-30 Thread David Raymond
> def how_many_times(): > x, y = 0, 1 > c = 0 > while x != y: > c = c + 1 > x, y = roll() > return c, (x, y) Since I haven't seen it used in answers yet, here's another option using our new walrus operator def how_many_times(): roll_count = 1 while (rolls := roll())[0] !=

Re: on writing a while loop for rolling two dice

2021-08-30 Thread Chris Angelico
On Mon, Aug 30, 2021 at 11:13 PM David Raymond wrote: > > > def how_many_times(): > > x, y = 0, 1 > > c = 0 > > while x != y: > > c = c + 1 > > x, y = roll() > > return c, (x, y) > > Since I haven't seen it used in answers yet, here's another option using our > new walrus operator

Re: on writing a while loop for rolling two dice

2021-08-30 Thread Peter Otten
On 30/08/2021 15:50, Chris Angelico wrote: def how_many_times(): return next((count, rolls) for count, rolls in enumerate(iter(roll, None)) if len(Counter(rolls)) == 1) That's certainly the most Counter-intuitive version so far;) Do I get bonus points for it being a one-liner that doe

Re: on writing a while loop for rolling two dice

2021-08-30 Thread Chris Angelico
On Tue, Aug 31, 2021 at 12:28 AM Peter Otten <__pete...@web.de> wrote: > > On 30/08/2021 15:50, Chris Angelico wrote: > > > def how_many_times(): > > return next((count, rolls) for count, rolls in > > enumerate(iter(roll, None)) if len(Counter(rolls)) == 1) > > > That's certainly the most Coun

Re: on writing a while loop for rolling two dice

2021-08-30 Thread Peter Otten
On 30/08/2021 06:17, dn via Python-list wrote: OTOH the simulation of rolling n-number of dice, as would happen in the real-world, would be broken by making the computer's algorithm more efficient (rolling until the first non-equal value is 'found'). Does that mean the realism of the model dies?

Setup.py + src: Modules not found

2021-08-30 Thread Abdur-Rahmaan Janhangeer
Greetings list, I have this project: https://github.com/pyhoneybot/honeybot I badly wanted to use setup.cfg but editable mode is not allowed for now. I then switched back to setup.py. This is my first time with src/, my entry point is src/honeybot/manage.py:main now in editable mode i manage t

Re: configargparse - reading option from config only

2021-08-30 Thread Loris Bennett
Richard Damon writes: > On 8/27/21 3:37 AM, Loris Bennett wrote: >> Richard Damon writes: >> >>> On 8/26/21 6:01 AM, Loris Bennett wrote: Hi, When using configargparse, it seems that if a value is to be read from a config file, it also has to be defined as a command-line argu

Re: code to initialize a sequence

2021-08-30 Thread Dennis Lee Bieber
On Sun, 29 Aug 2021 20:44:53 +0200, joseph pareti declaimed the following: >In the code attached below, the A-variant is from somebody else who knows >Python better than I. But I do not like to just use any code without having >a grasp, specifically the line in* bold*, so I wrote the B-variant wh

urgent

2021-08-30 Thread Hari
i was download ur python software but it is like boring user interface for me like young student to learn ,can u have any updates? -- https://mail.python.org/mailman/listinfo/python-list

The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-30 Thread hongy...@gmail.com
On Ubuntu 20.04.2 LTS, I use the [recent2](https://github.com/dotslash/recent2/blob/master/recent2.py) to log and query my bash history, which uses a sqlite3 database to store the history information. The `datetime` of running a command is inserted in the sqlite3 database with [a `unixepoch` f

software installation problems

2021-08-30 Thread randy darwin lozanovalle
Good morning, when I run the Python program after installing the latest version, I get this message (attached file), I have already reinstalled the program several times and the same message keeps appearing; What solution could you give me, thank you! -- https://mail.python.org/mailman/listinfo/py

Re: urgent

2021-08-30 Thread Igor Korot
Hi, On Mon, Aug 30, 2021 at 4:34 PM Hari wrote: > > i was download ur python software but it is like boring user interface for > me like young student to learn ,can u have any updates? Can you elaborate a little: Why do you want python? What task do you want to solve with python? Why python? Why

Re: software installation problems

2021-08-30 Thread Igor Korot
Hi, On Mon, Aug 30, 2021 at 4:37 PM randy darwin lozanovalle wrote: > > Good morning, when I run the Python program after installing the > latest version, I get this message (attached file), I have already > reinstalled the program several times and the same message keeps > appearing; What soluti

[RELEASE] Python 3.9.7 and 3.8.12 are now available

2021-08-30 Thread Łukasz Langa
Python 3.9.7 Get it here: https://www.python.org/downloads/release/python-397/ Python 3.9.7 is the newest major stable release of the Python programming language, and it contains many new features and optimizations. There’s been 187 commits

Re: software installation problems

2021-08-30 Thread Dennis Lee Bieber
On Mon, 30 Aug 2021 10:37:26 -0500, randy darwin lozanovalle declaimed the following: >Good morning, when I run the Python program after installing the >latest version, I get this message (attached file), I have already >reinstalled the program several times and the same message keeps >appearing;

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-30 Thread Dennis Lee Bieber
On Sun, 29 Aug 2021 19:49:19 -0700 (PDT), "hongy...@gmail.com" declaimed the following: >On Ubuntu 20.04.2 LTS, I use the >[recent2](https://github.com/dotslash/recent2/blob/master/recent2.py) to log >and query my bash history, which uses a sqlite3 database to store the history >information. T

Python UI (was Re: urgent)

2021-08-30 Thread Alan Gauld via Python-list
On 29/08/2021 11:28, Hari wrote: > i was download ur python software but it is like boring user interface I agree it is a boring user interface. Just 3 chevrons: >>> You can change it a little if you want but ultimately its just an invitation to type commands. What kind of interface did you have

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-30 Thread dn via Python-list
On 31/08/2021 11.07, Dennis Lee Bieber wrote: > On Sun, 29 Aug 2021 19:49:19 -0700 (PDT), "hongy...@gmail.com" > declaimed the following: ... > Might have helped to mention you were in China... To me, CST is North > America Central Standard Time (and I'd have expected this time of year to >

src layout for projects seems not so popular

2021-08-30 Thread Abdur-Rahmaan Janhangeer
Greetings list, Just an observation. Out of Github's trending repos for Python for today, I could find only 2 repos using the src layout. Matplotlib and another one. https://github.com/trending/python?since=daily Kind Regards, Abdur-Rahmaan Janhangeer about |