Flow Chart For a 'for' Loop In Python

  • #51
12,031
5,690
The Art of Computer Programming by Donald Knuth

https://en.m.wikipedia.org/wiki/The_Art_of_Computer_Programming
These are classics in the field though not everyone owns a copy. They are akin to an encyclopedia of algorithms and as such take some skill and effort to understand not necessarily a good fit for a newbie programmer.

I considered getting a copy but when i saw it coming out in fascicles decided to wait until it was finished. Im still waiting since 1982, it isnt finished and I imagine granddaughter will just have to wait too.
 
  • Like
Likes sysprog, Taylor_1989, QuantumQuest and 1 other person
  • #52
2
1
I don't use flowcharts that much but that is because I've finished learning how to use python and don't need them anymore. But, back when I was still learning python they were persistent on flowcharts being used as it was easier to understand the code. The way I learnt it was that parallelograms are a input or output, rectangles are a processes, ellipses are start or end, and diamonds are a decision or check whether a condition is met. I wouldn't stress about flowcharts because when you finish learning it no one uses it seriously.
 
  • Like
Likes Taylor_1989
  • #53
1,632
886
The Art of Computer Programming by Donald Knuth

https://en.m.wikipedia.org/wiki/The_Art_of_Computer_Programming
These are classics in the field though not everyone owns a copy. They akin to an encyclopedia of algorithms and as such take some skill and effort to understand not necessarily a good fit for a newbie programmer.

I considered getting a copy but when i saw it coming out in fascicles decided to wait until it was finished. Im still waiting since 1982, it isnt finished and I imagine granddaughter will just have to wait too.
Professor Donald Knuth is a man the praises regarding whom I cannot sing highly enough. Maybe his pipe organ (yes, everyone, he explains why it has to be a real pipe organ) can sing that high, but I can't. May all that is good be presented to that great man. And oh yeah when you use ##\TeX## you're using that man's code. He wrote it.
 
  • Like
Likes Klystron and Taylor_1989
  • #54
rcgldr
Homework Helper
8,707
534
At one of my old jobs, we bought a program that converted psuedocode into a flowchart, but after a couple of months, it became clear that the pseudocode was easier to follow than the flowchart, and the flowcharts were abandoned.

As for Python using a list for a counter, it's not clear with 3.0 and later versions what happens in range(). In Python 2.7, xrange() was used to iterate a counter, not produce a list, unlike range(), but Python 3.0 deprecated xrange(), and I'm not sure if Python doesn't optimize range() into xrange() depending on how it's used.
 
  • #55
12,031
5,690
My understanding is that range() is dynamic in this respect and similar to xrange() returning an iterator that generates the next number in sequence whereas the old range() generated a list, taking up a fair amount of memory, that was then iterated over.

https://www.pythoncentral.io/pythons-range-function-explained/
So range() became deprecated and xrange() became the new range() in python3.
 
  • Like
Likes Taylor_1989 and sysprog
  • #56
1,632
886
At one of my old jobs, we bought a program that converted psuedocode into a flowchart, but after a couple of months, it became clear that the pseudocode was easier to follow than the flowchart, and the flowcharts were abandoned.

As for Python using a list for a counter, it's not clear with 3.0 and later versions what happens in range(). In Python 2.7, xrange() was used to iterate a counter, not produce a list, unlike range(), but Python 3.0 deprecated xrange(), and I'm not sure if Python doesn't optimize range() into xrange() depending on how it's used.
Yes, that's true -- it was a problem regarding memory pre-allocation versus ad hoc dynamic allocation -- now it's dynamic-only .....
 
  • #57
1,632
886
My understanding is that range() is dynamic in this respect and similar to xrange() returning an iterator that generates the next number in sequence whereas the old range() generated a list, taking up a fair amount of memory, that was then iterated over.

https://www.pythoncentral.io/pythons-range-function-explained/
So range() became deprecated and xrange() became the new range() in python3.
I agree with what Sifu Jedi said.
 
  • #58
1,632
886
I made a glaring error in a post in response to @.Scott.
sysprog said:
You could wire the plug-board on a card duplicating machine to allow that, but how would you get, say, an IBM model 29 keypunch machine to do that? It not only doesn't detect which corner is cut, but also as far as I know, it has no capability to read anything on a card, except if you wrap the card around the program drum to be used as a program card, and in that case it could only heed the codes specific to that keypunch machine; not duplicate the card.
This is wrong. It completely ignores the read station on the Model 29. If, for example, you made an error on a single column of a card, say column 51, and didn't notice until you had typed all the way through column 71, you could feed the next blank card, the hit the reg (register) key, which would advance the prior card to the read station, and position the new card at the punch station. Then you could hit and hold the dup key to duplicate the first 50 characters, then type the corrected character for column 51. and then hit and hold the dup key for the rest of the remaining non-incorrect characters. Then when you hit the release key, you could discard the errant card, and be on your merry way. Sorry about the mis-statement earlier.
 
  • Like
Likes jedishrfu
  • #59
12,031
5,690
I am reminded of a story at GE years ago where a top keypunch operator noted for her speed was brought in to test the latest and greatest new keypunch machine guaranteed to handle the fastest typist until they met Sue. She typed so fast there were noticeable pauses on the machine while it struggled to keep up. She liked the machine but sadly no it’s wasn't fast enough for the best operators. The sales guy was quite flummoxed over it but GE bought a few anyway.
 
Last edited:
  • #60
1,632
886
Professor Knuth (Donald Knuth, of TAoCP and ##\TeX## fame) used to regularly outspeed the fastest electric typewriters. He loved the first IBM Selectric he encountered, in part because although he could outspeed it too, its buffering capability allowed it to catch up when he'd pause.
 
  • #61
anorlunda
Staff Emeritus
Insights Author
8,714
5,602
The secret of the ASR 33 and ASR 35 teletype machines was some kind of force feedback (I don't know how it worked), that forced you to slow down and type in perfect rhythm with the machine. That did not make fast typing, but it greatly reduced the error rate.

Even today, I wager that I could type with fewer errors with the help of a metronome.
 
  • #62
12,031
5,690
Some vintage history on the teletype

http://www.samhallas.co.uk/repository/telegraph/teletype_story.pdf
And more specifically the asr33

https://en.m.wikipedia.org/wiki/Teletype_Model_33
The heavier key press was due to electromechanical feel of a typewriter. I suspect it may have been an engineering scheme to control the speed of the character bits written to tape or sent over the line as well as typing it on the paper. It’s true though you developed a certain rhythm when typing at about 10 characters per second.
 
Last edited:
  • Informative
Likes anorlunda
  • #63
.Scott
Homework Helper
2,622
952
The secret of the ASR 33 and ASR 35 teletype machines was some kind of force feedback (I don't know how it worked), that forced you to slow down and type in perfect rhythm with the machine.
A key part of that mechanism was the requirement for deep keystrokes. You had to push the key down about half an inch for it to register - and once one key was down, the next could not be pressed at all until the first key had fully returned to its original position. Since a key would not return to its original position until the cycle had ended, you couldn't type ahead at all.
 
  • Like
  • Informative
Likes jbriggs444 and anorlunda

Related Threads on Flow Chart For a 'for' Loop In Python

  • Last Post
Replies
11
Views
906
Replies
7
Views
2K
Replies
5
Views
1K
  • Last Post
Replies
4
Views
1K
  • Last Post
Replies
1
Views
1K
Replies
3
Views
994
Replies
18
Views
4K
Replies
7
Views
586
Replies
6
Views
2K
  • Last Post
Replies
18
Views
1K
Top