Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: math problem using recursion?
Post: RE: math problem using recursion?

Thanks for the help. Sometimes the logic behind these things eludes me. I think we can say this one is solved. :)
mnh001 Homework 14 4,518 Sep-03-2020, 07:34 PM
    Thread: math problem using recursion?
Post: RE: math problem using recursion?

Ok, I got that alright. Here: try: divisors(newList[passes]) passes += 1 except: breakIt seems to give the same results as yours. I have since adde...
mnh001 Homework 14 4,518 Sep-03-2020, 02:34 PM
    Thread: math problem using recursion?
Post: RE: math problem using recursion?

Ok, let me try to work that out. One thing I like already that I had forgotten all about is the mod operator. Have no idea why I didn't think of that. Anyway I'll get back once I get something that wo...
mnh001 Homework 14 4,518 Sep-02-2020, 06:24 PM
    Thread: math problem using recursion?
Post: RE: math problem using recursion?

Ok, first, it is a decimal point. I was only using it to delineate between the factors for visual clarity. Next, I didn't know if this was a good problem for recursion. I was kinda hoping it was just...
mnh001 Homework 14 4,518 Sep-02-2020, 02:35 PM
    Thread: math problem using recursion?
Post: RE: math problem using recursion?

As for the previous questions, the only requirement for the start number is that it is a semi-prime. And I doubt whether the chain lengths would ever get above 20 or 30. Ok, here is my revised code. ...
mnh001 Homework 14 4,518 Sep-01-2020, 10:57 PM
    Thread: math problem using recursion?
Post: RE: math problem using recursion?

Sure. Ok, here's some code. I know it's not pretty and it still needs some fixing but it seems to work good enuf for testing purposes. This creates a dictionary of semi-primes and their factors. sp_d...
mnh001 Homework 14 4,518 Sep-01-2020, 08:17 PM
    Thread: math problem using recursion?
Post: math problem using recursion?

First the problem. 1. Start with a semi-prime (eg, 15 = 3 * 5). 2. Take the factors and concatenate them both forwards and backwards to give 2 new numbers. (Ie, 35 and 53) 3. Test for semi-prime-ness....
mnh001 Homework 14 4,518 Sep-01-2020, 03:54 PM
    Thread: file.write not working properly
Post: RE: file.write not working properly

Ah, I didn't know it could be done that way. I've only been doing python for about 2 months now. I like it.
mnh001 General Coding Help 11 4,489 Nov-09-2019, 10:20 PM
    Thread: file.write not working properly
Post: RE: file.write not working properly

Ah, that did it. I totally forgot the parenthesis. Thanks.
mnh001 General Coding Help 11 4,489 Nov-09-2019, 08:09 PM
    Thread: file.write not working properly
Post: RE: file.write not working properly

Hmmm. For you it seems to be fine. For me, my cd4.txt ends like this: Output:9878, [0] 9879, [-165, 252, 81, 63, 27, -45, -9] 9880, [14625, 5598, 675, 54, 9] 9881, [10400, 1025, -416, 209, 737, 272, ...
mnh001 General Coding Help 11 4,489 Nov-09-2019, 06:57 PM
    Thread: file.write not working properly
Post: RE: file.write not working properly

Oh, sorry. The range is the while loop in line 30. If the side is 4 (line 22) then the code loops from 1000 to 9999 via line 30. The hold variable is incremented in line 41, which updates the num_in...
mnh001 General Coding Help 11 4,489 Nov-09-2019, 06:31 PM
    Thread: file.write not working properly
Post: RE: file.write not working properly

Oh ya, I know it's my code. I never assume I'm smarter than the code. Anyway, all 3 ranges I've tried so far(10-100 no write at all, 100-1000 only writes up to 720, 1000-10000 only writes to 9884) fai...
mnh001 General Coding Help 11 4,489 Nov-09-2019, 05:48 PM
    Thread: file.write not working properly
Post: file.write not working properly

I'm having a problem with writing to file. It only works part time. I have a print statement right after the file.write line and it shows that everything is being calculated correctly. Other scripts I...
mnh001 General Coding Help 11 4,489 Nov-09-2019, 05:14 PM
    Thread: printing sideways
Post: RE: printing sideways

Ah, that's what it is. That works great. Thanks.
mnh001 General Coding Help 2 1,937 Sep-07-2019, 09:18 PM
    Thread: printing sideways
Post: printing sideways

I'm trying to print things out in a line but obviously missing something. For the code a = 5 print(f'{a} ['); for x in range(1, 11) : print(f'{x}, ') print(']')it prints 5 [ 1, 2, 3, 4, 5, ...
mnh001 General Coding Help 2 1,937 Sep-07-2019, 08:30 PM
    Thread: Help on drawing a shape and slider
Post: RE: Help on drawing a shape and slider

Well, perhaps someone else out there will know the answer. Till then I just keep on truckin'.
mnh001 GUI 12 5,524 Aug-22-2019, 11:21 PM
    Thread: Help on drawing a shape and slider
Post: RE: Help on drawing a shape and slider

(Aug-22-2019, 07:29 PM)Denni Wrote: Well try this answer - sorry Tkinter is not my area of expertise ;) https://stackoverflow.com/questions/3963...der-to-100 No, that didn't work either. I've tried...
mnh001 GUI 12 5,524 Aug-22-2019, 07:51 PM
    Thread: Help on drawing a shape and slider
Post: RE: Help on drawing a shape and slider

Ah, yes I see. Pass the value as the argument of the function. def mod_calc(slider_value) :It works. Unfortunately it doesn't fix the problem with the scale start value changing by itself to 0 when ...
mnh001 GUI 12 5,524 Aug-22-2019, 07:09 PM
    Thread: Help on drawing a shape and slider
Post: RE: Help on drawing a shape and slider

Oh, sure. It's not very pretty but here's what I've got. And yes I know I repeated myself with the update_circle def but ... import math import tkinter from tkinter import * def update_circle() : ...
mnh001 GUI 12 5,524 Aug-22-2019, 11:27 AM
    Thread: Help on drawing a shape and slider
Post: RE: Help on drawing a shape and slider

Well, your ploy worked. I figured it out once I learned there was something called tkinter. It took a bit to discover how to pass the value of the slider to a variable but after that it was ok. A new...
mnh001 GUI 12 5,524 Aug-21-2019, 08:50 PM

User Panel Messages

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