The best way to learn how to write pseudocode is to simply start to write it. Luckily it is very simple to do.
Now with pseudocode, some people like to write a start/end
or begin/end
, just like with a flowchart. This isn’t required, however, it can make things more clear, and you can see an example of that below.
Start
End
Writing Linear Statements
Writing linear statements is very easy. We simply specify what we want done. How detailed is depending upon your situation.
As a new developer, I recommend writing out very detailed specifications, so that you don’t miss anything in your logic. As you gain experience, you may choose to write less detailed, and more “high level” comments which you can interpret easier. As long as everyone can read it, that if fine.
Each command, should be on it own separate line. If you need a second command, it then goes on a second line. This repeats until all of the steps are completed.
Sending Data to the User
Typically sending data to the user will be done with something like a print
, or output
statement, followed by what you want to send to the user. Once again, there is no “rule” it just needs to be obvious to anyone who is reading it.
Since we start with Python as our first programming language, I recommend print, as this is the commend it uses, and it helps reduce confusion.
print "Hello World"
As with flowcharts, literal strings, those that are exactly as we see them, are enclosed within quotes. They can be single, or double quotes, which ever is easier for you.
So the full thing might look like:
Start
print "Hello World"
End
Simple Pseudocode Statements was originally found on Access 2 Learn