Re: Python homework

2017-12-13 Thread Lorenzo Sutton
Hi, On 05/12/17 06:33, nick martinez2 via Python-list wrote: I have a question on my homework. My homework is to write a program in which the computer simulates the rolling of a die 50 times and then prints (i). the most frequent side of the die (ii). the average die value of all rolls. For t

Answers to homework questions [WAS]: Re: Python homework

2017-12-14 Thread Lorenzo Sutton
Hi Roger, On 13/12/17 23:31, ROGER GRAYDON CHRISTMAN wrote: On Wed, Dec 13, 2017, Lorenzo Sutton wrote: On 05/12/17 06:33, nick martinez2 via Python-list wrote: I have a question on my homework. [...] For this kind of problem I think the collections module [1] can be very useful. In this

Re: How to reduce the DRY violation in this code

2016-09-28 Thread Lorenzo Sutton
On 27/09/2016 17:49, Steve D'Aprano wrote: I have a class that takes a bunch of optional arguments. They're all optional, with default values of various types. For simplicity, let's say some are ints and some are floats: class Spam: def __init__(self, bashful=10.0, doc=20.0, dopey=30.0,

Re: The irony

2016-05-11 Thread Lorenzo Sutton
On 10/05/2016 20:03, DFS wrote: "There should be one-- and preferably only one --obvious way to do it." https://www.python.org/dev/peps/pep-0020/ "Explicit is better than implicit." What is your use case and scenario? :-) Maybe it's better to write a function to automatise this so that if i

Re: python parsing suggestion

2016-05-30 Thread Lorenzo Sutton
Hi, On 30/05/2016 09:34, Ganesh Pal wrote: Hi , Trying to extract the '1,1,114688:8192' pattern form the below output. pdb>stdout: '3aae5d0-1: Parent Block for 1,1,19169280:8192 (block 1,1,114688:8192) --\n3aae5d0-1: magic 0xdeaff2fe mark_cookie 0x\ngpal-3aae5d0

Re: Tk alternative to askopenfilename and askdirectory?

2015-12-16 Thread Lorenzo Sutton
On 16/12/2015 14:18, Ulli Horlacher wrote: Is there an alternative to Tk's askopenfilename() and askdirectory()? I want to select a files and directories within one widget, but askopenfilename() let me only select files and askdirectory() let me only select directories. I guess it would he

Re: global and loop control variable

2015-07-23 Thread Lorenzo Sutton
On 23/07/2015 12:24, candide wrote: [...] Now, global declaration has another restriction, as PLR explains: [https://docs.python.org/3.4/reference/simple_stmts.html#the-global-statement] ~ Names listed in a global statement must not be defined as formal pa

Re: global and loop control variable

2015-07-23 Thread Lorenzo Sutton
On 23/07/2015 14:31, Steven D'Aprano wrote: On Thu, 23 Jul 2015 09:20 pm, Lorenzo Sutton wrote: On 23/07/2015 12:24, candide wrote: Now, global declaration has another restriction, as PLR explains: [https://docs.python.org/3.4/reference/simple_stmts.html#the-global-stat

Re: XML Binding

2015-09-04 Thread Lorenzo Sutton
Hi, On 03/09/2015 21:54, Burak Arslan wrote: Hello, On 09/03/15 19:54, Palpandi wrote: Hi All, Is there any module available in python standard library for XML binding? If not, any other suggestions. lxml is the right xml library to use. You can use lxml's objectify or Spyne. I second lx

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Lorenzo Sutton
On 18/09/2015 13:41, Jondy Zhao wrote: [...] In reality, when we leave the house, we lock the door, even the lock could not make sure the safe of our property. It's just make it difficult. It's same in the software world. Someone need the lock in both of the world. I think you meant "in the *pr

Python 3 windows installer problem [WAS: Re: an installing problem]

2015-09-23 Thread Lorenzo Sutton
Hi, Not too familiar with the 'new' Python 3 installer on windows.. but On 23/09/2015 13:37, Narges Asadi wrote: Hello I’ve encountered a problem when I wanted to install Python 3.5. I sent you the log file. Please help me to fix the problem. From the log: [0F4C:1110][2015-09-23T14:54:17]e0

Re: Python, convert an integer into an index?

2015-09-24 Thread Lorenzo Sutton
On 23/09/2015 17:32, Denis McMahon wrote: On Tue, 22 Sep 2015 14:43:55 -0700, Chris Roberts wrote: results = 134523 #(Integer) This appears to be an integer expressed (presumably) in base 10 with 6 digits Desired: results = [1, 2, 3, 4, 5, 2, 3] #(INDEX) This appears to be a pyth

Re: Detection of a specific sound

2015-11-02 Thread Lorenzo Sutton
On 26/10/15 01:17, Montana Burr wrote: I'm looking for a library that will allow Python to listen for the shriek of a smoke alarm. Once it detects this shriek, it is to notify someone. Ideally, specificity can be adjusted for the user's environment. For example, I expect to need moderate specific

Re: Question about math.pi is mutable

2015-11-06 Thread Lorenzo Sutton
On 06/11/2015 13:30, Bartc wrote: On 06/11/2015 02:33, wa...@travelsky.com wrote: Hello, python-list guys: I am a newbie of python from Beijing. China. I have a question about "math.pi". As you can see in the attachment, why i can modify "math.pi"? (in "mathmodule.c" "pi"