Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: failing to print not matched lines from second file
Post: RE: failing to print not matched lines from second...

First of all, the "l_few" (file with fewer lines) is file_1 according to the text, so I swapped the file names to change as little as possible in your original program. Then I came up with this, hope ...
Serafim General Coding Help 13 786 Mar-29-2021, 11:27 AM
    Thread: For loops index
Post: RE: For loops index

Manually changing the index variable value in a for loop is not recommended. If you need a loop, set the limits outside of the loop and then enter the loop. If you have to change the index variable va...
Serafim General Coding Help 5 279 Mar-23-2021, 09:29 AM
    Thread: Stranger in our midst
Post: RE: Stranger in our midst

While I prefer to do it this way: words = [] new_word = input('Enter a word\n') while new_word.lower() != 'stop': words.append(new_word) new_word = input('Enter a word\n') print(words)
Serafim Homework 3 276 Mar-22-2021, 01:21 PM
    Thread: Help with Dictionaries problem
Post: RE: Help with Dictionaries problem

I haven't really understood error 1) unless you want the last line in the menu to be printed without a newline but I am not certain that that is your problem. The second error is easier to explain. Yo...
Serafim Homework 2 243 Mar-22-2021, 09:02 AM
    Thread: Problem with print formatting using definitions
Post: RE: Problem with print formatting using definition...

Well, the encrypted message prints fine but why do you print it inside the encrypt function? The print function prints the text but returns None. Let line 13 be just return cipherand it will work.
Serafim Homework 2 241 Mar-20-2021, 06:21 PM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

Tested to use blist instead of the python standard list. Blist is a binary structure (binary tree / b-tree / b+-tree, don't know which) and is supposed to be a faster direct replacement for list. But ...
Serafim Game Development 24 1,484 Mar-17-2021, 03:04 PM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

Well, whatever OCD I suffer from, gaming is not one of them **lolsign** . I think that first of all you need to consider which of the number sequences you want to use. Not all of them have interestin...
Serafim Game Development 24 1,484 Mar-16-2021, 09:10 AM
    Thread: return in a function
Post: RE: return in a function

(Mar-06-2021, 01:04 PM)snippsat Wrote: Need or not,so to we get switch case version in Python 3.10. Called Structural Pattern Matching which is more powerful that just simple switch case.Nice! I wou...
Serafim News and Discussions 16 2,311 Mar-15-2021, 11:00 AM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

I implemented a method to generate fortunate numbers but it was too slow due to my naive implementation of checking primes and to find the smallest prime larger than a certain number, which is require...
Serafim Game Development 24 1,484 Mar-14-2021, 08:57 AM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

After reading a lot on the subject I decided to abandon the conversion to numpy as "dtype=object" is absolutely necessary for manipulating very large numbers (larger than 2**64) and using numpy arrays...
Serafim Game Development 24 1,484 Mar-12-2021, 03:55 PM
    Thread: Tkinter guide?
Post: RE: Tkinter guide?

Took a look at AutoHotKey and for the simplest of tasks it seems simple but if you want to do complicated stuff it does not seem simpler than other GUI builders and, on top of that, it's only for wind...
Serafim GUI 16 1,005 Mar-12-2021, 03:22 PM
    Thread: Tkinter guide?
Post: RE: Tkinter guide?

Then why not use one of the wrappers around tkinter like e.g. PySimpleGUI. I also thought tkinter, and other GUI stuff was complicated so when asked to create a simple Japanese character learning appl...
Serafim GUI 16 1,005 Mar-12-2021, 02:58 PM
    Thread: Tkinter guide?
Post: RE: Tkinter guide?

There are lots of free books in pdf format, e.g. Python GUI Programming With Tkinter or Tkinter By Example
Serafim GUI 16 1,005 Mar-12-2021, 02:17 PM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

I thought that it would be more efficient to use numpy arrays and tried with "fibn": def fibn(start, length, n): if n < 2: return [] seq = np.zeros(length, dtype='uint64') seq[n...
Serafim Game Development 24 1,484 Mar-12-2021, 09:55 AM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

I'll continue to, during breaks, look at integer sequences. If there are other kinds of series and sequences that are interesting, let me know. I have also done a lot of numerical programming, if thin...
Serafim Game Development 24 1,484 Mar-11-2021, 08:32 AM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

I don't know if pratical numbers are interesting but if they are this implementation is a bit slow (a couple of seconds for a list with 100 practical numbers), maybe it can be speeded up a bit. from i...
Serafim Game Development 24 1,484 Mar-10-2021, 09:19 PM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

A couple of more sequences: def arithmetic(n): # https://en.wikipedia.org/wiki/Arithmetic_number seq = [] x = 1 while len(seq) < n: divisors = [i for i in range(1,x+1) if no...
Serafim Game Development 24 1,484 Mar-10-2021, 10:36 AM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

Forgot to say that the generalization on fibonacci, "fibn", has a new, simplified form. I no longer look for special cases. Instead I slice the resulting sequence. Shorter code but probably not as tim...
Serafim Game Development 24 1,484 Mar-08-2021, 08:55 PM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

Hi again! Some time spent on the internet departing from the wikipedia page on number sequences gave these number sequence functions. Mostly number sequences with some graphical interpretation. from ...
Serafim Game Development 24 1,484 Mar-08-2021, 08:21 PM
    Thread: Fibonacci graphics ideas?
Post: RE: Fibonacci graphics ideas?

I played a little with your gen_fib, letting start to always be 1 and to generate any of the generalized fib sequences (shortened the name to gen_ib, but ...) def gen_ib(length, n): '''Function to...
Serafim Game Development 24 1,484 Mar-06-2021, 12:44 PM

User Panel Messages

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