Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: how to compare two cards games?
Post: RE: how to compare two cards games?

Just a small point if you are into card games. Why call the suits a,b,c,d ? Maybe d for diamonds, h for hearts ... Easier. Paul
DPaul Homework 6 224 Nov-25-2021, 08:28 AM
    Thread: canvas image problem
Post: RE: canvas image problem

Hi, Thanks for all the help. I wish the tkinter docs would explain things better. I now understand why the image is disappearing. So it seems I can stuff the reference anywhere. My photoImage is ca...
DPaul GUI 4 162 Nov-24-2021, 07:06 AM
    Thread: canvas image problem
Post: RE: canvas image problem

OK, I will study those. All in all, there is virtually no difference between the second example and mine. I have not tried the subsample one. Will do, and report back. Paul
DPaul GUI 4 162 Nov-23-2021, 06:23 PM
    Thread: Grid the radio buttons
Post: RE: Grid the radio buttons

a) There is a special sub-forum for tkinter questions b) You are packing now, where on the grid do you want them? Paul
DPaul GUI 6 236 Nov-23-2021, 04:18 PM
    Thread: canvas image problem
Post: canvas image problem

Hi, The (abbreviated) code below does exactly what it is supposed to do. -Open an image -resize it -show it on canvas But it shows no picture. I have found that this could be because of the garbage ...
DPaul GUI 4 162 Nov-23-2021, 03:18 PM
    Thread: Trouble with svg format
Post: RE: Trouble with svg format

23 minutes later. I don't believe it; but it actually delivers the goods. thanks, Paul
DPaul General Coding Help 4 225 Nov-12-2021, 11:01 AM
    Thread: Trouble with svg format
Post: RE: Trouble with svg format

@ Larz60+ This looks promising. Will try and report on progress. Paul
DPaul General Coding Help 4 225 Nov-12-2021, 10:37 AM
    Thread: Trouble with svg format
Post: Trouble with svg format

Hi, I am using python-barcode to create barcodes. It produces .svg images and it works great, very crisp images. I insert these barcodes manually into a word document = time consuming. So I set out ...
DPaul General Coding Help 4 225 Nov-12-2021, 10:02 AM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

Hi, I gave this "interview question" some considerable thought, because I want to get hired next time. **smile** My basic idea was to reduce the size of the original array, effectively reducing the...
DPaul General Coding Help 29 2,916 Nov-07-2021, 08:39 AM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

Hi, The nested loop approach ("brute force") will produce the goods, but for the (-100/+100, array = 30) case it will take 24+ seconds.(100_000 iterations) I set out to see if this approach could be ...
DPaul General Coding Help 29 2,916 Nov-04-2021, 07:37 AM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

Hi, I made a small tweak, so that the sum array does not get very large. This does not take away that my loop x loop version is obviously slower than the other versions. I did some timing measurement...
DPaul General Coding Help 29 2,916 Nov-01-2021, 08:39 AM
    Thread: Programming robots using Python
Post: RE: Programming robots using Python

Hi, If you are really starting out with python and robots, buy a micro:bit , program it with (micro)python, and use it with a bit:bot. Endless fun. Paul
DPaul General Coding Help 5 338 Oct-31-2021, 06:31 AM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

Point taken. There is critique on my command of the Queen's English. Therefore, in my post, read "very well" as "occasionally". **shy** Paul
DPaul General Coding Help 29 2,916 Oct-30-2021, 05:20 PM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

I ran several tests with both proposed codes, up to len(arr) = 100, and I get the same results. So for what it's worth: maxArr = [max(arr)] for number in range(len(arr)): for grouping in range(2...
DPaul General Coding Help 29 2,916 Oct-30-2021, 06:43 AM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

(Oct-29-2021, 07:08 PM)Gribouillis Wrote: For me the correct answer for [-1, -2, -3, -4] is 0, the sum of the empty list. Could you elaborate please? Do you see this as a mathematical concept or a ...
DPaul General Coding Help 29 2,916 Oct-30-2021, 05:38 AM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

(Oct-29-2021, 05:59 PM)deanhystad Wrote: There is an error in my code in that it starts with the assumption that the max sum will be greater than 0. It would be better if it initialized maxsum to [...
DPaul General Coding Help 29 2,916 Oct-29-2021, 06:25 PM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

(Oct-29-2021, 04:12 PM)deanhystad Wrote: Generate random lists of numbers and use the posted code(s) to compute the answer. You don't need an answer sheet when you have code that generates the corr...
DPaul General Coding Help 29 2,916 Oct-29-2021, 05:19 PM
    Thread: In linear time, find the maximum sum of all possible contiguous subarrays
Post: RE: In linear time, find the maximum sum of all po...

@ Griboullis, @ deanhystad From time to time, an interesting challenge pops up :-) For the aged students amongst us, could you provide one or two solutions, from arrays len(100), that you know are co...
DPaul General Coding Help 29 2,916 Oct-29-2021, 03:48 PM
    Thread: Remove post
Post: RE: referenced before assignment issue?

Why is the spelling of finish in lines 2/3, different from line 28 ? Paul
DPaul General Coding Help 3 306 Oct-21-2021, 06:02 AM
    Thread: Printing During a Loop
Post: RE: Printing During a Loop

It is very difficult to give advice, if the code is not properly indented , using python tags. Paul
DPaul Homework 16 940 Oct-19-2021, 05:44 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020