Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: MAC Python IDLE issue
Post: RE: MAC Python IDLE issue

I suggest to rethink your workflow. In programming it is customary to use terminal/shell. Under Monterey I had no trouble opening .py files in using Open with > IDLE in Finder irrespective whether...
perfringo General Coding Help 4 505 Oct-28-2021, 06:32 AM
    Thread: About List & Tuples
Post: RE: About List & Tuples

Usually documentation is good starting point : Tuples and Sequences
perfringo News and Discussions 4 333 Oct-09-2021, 11:01 AM
    Thread: Showing and saving the output of a python file run through bash
Post: RE: Showing and saving the output of a python file...

You should tell Python to run the file, so from bash one can do: python my_program.py > my_program_output.txtFrom within Python one can print to file and write to file.
perfringo General Coding Help 3 429 Oct-04-2021, 02:59 PM
    Thread: NameError issue with daughter's newb code
Post: RE: NameError issue with daughter's newb code

There is difference between reference and assignment: When you reference a variable in an expression, the Python interpreter will traverse the scope to resolve the reference in following order: - cu...
perfringo General Coding Help 2 345 Sep-16-2021, 01:01 PM
    Thread: Newbie have thoughts about logic
Post: RE: Newbie have thoughts about logic

(Sep-15-2021, 11:11 AM)sdd Wrote: I don't agree with your logic. 0 is the starting point. As soon as you start moving away from that starting point you are on 1. My real starting point as a human be...
perfringo General Coding Help 32 2,123 Sep-16-2021, 07:07 AM
    Thread: Newbie have thoughts about logic
Post: RE: Newbie have thoughts about logic

(Sep-15-2021, 01:07 AM)sdd Wrote: Nobody starts counting with zero so it's unlogical to me. Are you nobody? I suspect that like rest of us you were born 0 years old and not 1 year old. So you litera...
perfringo General Coding Help 32 2,123 Sep-15-2021, 03:35 AM
    Thread: Newbie have thoughts about logic
Post: RE: Newbie have thoughts about logic

(Sep-12-2021, 06:11 PM)sdd Wrote: if for-loop means for each - why not simply use the for each expression in python instead of the for-loop expression? Then people didn't have to learn that for-loop...
perfringo General Coding Help 32 2,123 Sep-13-2021, 06:15 AM
    Thread: New to python and need help with spacing
Post: RE: New to python and need help with spacing

For me it smells like homework. So I provide one partial way to do it - how to print rectangle, but without center. def do_rectangle(height=5, width=7, characters='GIS'): inner_width = len(chara...
perfringo General Coding Help 12 816 Sep-12-2021, 06:13 AM
    Thread: New to python and need help with spacing
Post: RE: New to python and need help with spacing

(Sep-11-2021, 08:28 PM)pmorgan39339 Wrote: (Sep-11-2021, 08:21 PM)perfringo Wrote: Is it Python 2? Its Python 3.9 Have you tried to run your code then? >>> x = raw_input ("What are your...
perfringo General Coding Help 12 816 Sep-11-2021, 08:51 PM
    Thread: numpy 2-dimentional
Post: RE: numpy 2-dimentional

(Sep-11-2021, 04:54 PM)rwahdan Wrote: What did I do wrong? I don't know what you did wrong, but you (probably accidentally) used advanced indexing. This means that first list gives rows indices and ...
perfringo Data Science 3 437 Sep-11-2021, 08:44 PM
    Thread: New to python and need help with spacing
Post: RE: New to python and need help with spacing

Is it Python 2? You should think it through before starting to code. If you take input from user, then it could be one character or five or whatnot. This means that number of spaces depends from user...
perfringo General Coding Help 12 816 Sep-11-2021, 08:21 PM
    Thread: Add elements to a Dictionary
Post: RE: Add elements to a Dictionary

There are lot of ambiguity for me, so just some examples of dict and EAFP: >>> ratings = {'Peppa the Pig': 5} >>> ratings.update([('Bob the Builder', 10)]) >>> ratings {'Pe...
perfringo General Coding Help 12 864 Sep-08-2021, 07:52 PM
    Thread: Newbie have thoughts about logic
Post: RE: Newbie have thoughts about logic

Consider this: - for-loop means 'for each' and 'for each letter in word' is very logical in my mind - for-loop is not the only loop in Python. There is also while-loop. Introducing 'loop' will theref...
perfringo General Coding Help 32 2,123 Sep-02-2021, 04:15 AM
    Thread: q re glob.iglob iterator and close
Post: RE: q re glob.iglob iterator and close

itertools module documentation has recipes chapter and there is function consume for consuming iterator: def consume(iterator, n=None): "Advance the iterator n-steps ahead. If n is None, consume ...
perfringo General Coding Help 2 445 Aug-23-2021, 10:14 PM
    Thread: ascii question
Post: RE: ascii question

Thread name consists ascii. So lazy person like me would do: >>> ''.join(chr(i) for i in range(32, 127)) ' !"#$%&\'()*+,-./0123456789:;<=>[email protected][\\]^_`abcdefg...
perfringo General Coding Help 9 843 Aug-21-2021, 05:50 PM
    Thread: Still do not get how Python iterates over a file
Post: RE: Still do not get how Python iterates over a fi...

It always a good idea to start with the plan. So how can problem at hand described? - for every item in list_1 check whether any item in list_2 starts with it - if match is found I want to print it o...
perfringo General Coding Help 13 1,109 Aug-21-2021, 07:34 AM
    Thread: Help with for loop
Post: RE: Help with for loop

Probably it's good to understand how for-loop works. For intro it's sufficient to type help('for') into the interactive interpretator: Output:/.../ The "for" statement is used to iterate over the ele...
perfringo General Coding Help 4 538 Aug-17-2021, 05:48 PM
    Thread: NEED HELP NEW TO PYTHON!!
Post: RE: NEED HELP NEW TO PYTHON!!

It is always good to have names. This makes comprehending much more easier for humans (computer doesn't care :-). So you first iteration could become (EDIT: rates are changed compared to your example...
perfringo General Coding Help 6 916 Aug-14-2021, 07:09 AM
    Thread: Change the varaible in For Loop
Post: RE: Change the varaible in For Loop

Did you know that Python comes with built-in help? Quote:Why am I seeing 2 and 3 instead of 4 and 5 ? >>> help('for') The "for" statement ******************* The "for" statement is used ...
perfringo General Coding Help 2 600 Aug-13-2021, 02:56 PM
    Thread: things that work in terminal mode but not in sublime mode
Post: RE: things that work in terminal mode but not in s...

What is/define “terminal mode” and “can’t get to work in sublime text”
perfringo General Coding Help 4 737 Aug-10-2021, 03:50 PM

User Panel Messages

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