Python - Writing pseudocode? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.

Closed 11 years ago .

How would you write pseudocode for drawing an 8-by-8 checkerboard of squares, where none of the squares have to be full? (Can all be empty) I don't quite get the pseudocode concept.

206k 41 41 gold badges 399 399 silver badges 412 412 bronze badges asked Sep 20, 2009 at 22:52 user176073 user176073

Think of writing pseudocode like you would explain it to another person - it doesn't generally have to conform to any particular syntax as long as what's happening is clear to the grader.

Commented Sep 20, 2009 at 23:07 -1: Writing pseudo-code == doing my homework for me. Commented Sep 21, 2009 at 10:46

5 Answers 5

I would be even more generic eg.

Loop with x from 1 to 8 Loop with y from 1 to 8 draw square at x, y 
answered Sep 20, 2009 at 23:09 553 4 4 silver badges 6 6 bronze badges So that would be all there is to it? You don't have to include actual code? – user176073 Commented Sep 20, 2009 at 23:14 @Steve: pseudo=fake. so no code is needed :-) Commented Sep 20, 2009 at 23:19

Wikipedia articles use Pseudocode a lot, quite successfully. There is no standard for Pseudocode on wikipedia, and syntax varies, but here is some general information with examples: Algorithms on Wikipedia

Here are two good examples of articles with Pseudocode (more):

Using Wikipedia-like style, I'd do:

for i from 0 to 7 for j from 0 to 7 if (i + j) is even then paint square (i, j) black else paint square (i, j) white 

(Marking end of if or end of for with 'end if' or 'repeat'/'end for' is a matter of style I guess).

answered Sep 21, 2009 at 0:40 u0b34a0f6ae u0b34a0f6ae 49.3k 14 14 gold badges 95 95 silver badges 101 101 bronze badges

Pseudo code is writing out the code in form that is like code but not quite code. So for opening a file and printing printing out its lines of text

if file exists(path_to_file) then : open (path_to_file) for each line in file : print the line of the file 

All you should do is create the sequence of steps needed for your problem and write it out like that. Since you mention python, just use use a more python like syntax in your pseudo code.

I suspect that you problem will be to encourage you to consider how to make functions and classes, and writing the pseudo code first will help you do this.