1. Pseudocode
1.1. Python to Pseudocode Summary
Python |
Pseudocode |
|---|---|
== |
= |
= |
← |
OUTPUT or PRINT or DISPLAY |
|
input |
INPUT or GET |
if |
IF ….THEN |
elif |
ELSEIF ….THEN |
else |
ELSE |
“end of if” |
ENDIF |
for |
FOR |
“end of for” |
ENDFOR |
while |
WHILE |
“end of while” |
ENDWHILE |
def |
FUNCTION |
“end of def” |
ENDFUNCTION |
return |
RETURN |
or |
OR |
and |
AND |
not |
NOT |
True |
TRUE |
False |
FALSE |
try |
TRY |
except |
EXCEPT |
pass |
PASS |
class |
CLASS |
“end of class” |
ENDCLASS |
import |
IMPORT |
open “a file” |
OPEN |
read “a file” |
READ |
write “to a file” |
WRITE |
1.2. Arithmetic Operators
Operator |
Symbol |
Meaning |
Example |
Result |
|---|---|---|---|---|
Addition |
|
Adds two values |
|
|
Subtraction |
|
Subtracts right from left |
|
|
Multiplication |
|
Multiplies two values |
|
|
Division |
|
Divides left by right |
|
|
Integer Division |
|
Quotient without remainder |
|
|
Modulus |
|
Remainder after division |
|
|
Exponentiation |
|
Raises to a power |
|
|
Negation |
|
Unary minus (sign change) |
|
|
1.3. Relational and Logical Operators
Operator |
Symbol |
Meaning |
Example |
Result |
|---|---|---|---|---|
Equal |
|
Tests equality |
|
|
Not Equal |
|
Tests inequality |
|
|
Greater Than |
|
Left greater than right |
|
|
Less Than |
|
Left less than right |
|
|
Greater or Equal |
|
Left greater or equal to right |
|
|
Less or Equal |
|
Left less or equal to right |
|
|
AND |
|
Logical conjunction |
|
|
OR |
|
Logical disjunction |
|
|
NOT |
|
Logical negation |
|
|
Keyword |
Meaning / Usage |
|---|---|
BEGIN |
Entry point of the pseudocode program |
PROCEDURE |
Defines a procedure (subroutine) |
ENDPROCEDURE / END PROCEDURE |
Marks the end of a procedure |
PROCESS |
Defines a process (similar to procedure, sometimes used in flowcharts) |
ENDPROCESS / END PROCESS |
Marks the end of a process |
CALL |
Calls a function or procedure |
CASE / OF |
Multi-way branch (like switch/case) |
ENDCASE / END CASE |
Marks the end of a case block |
STEP |
Increment in a FOR loop |
LOOP |
General loop construct |
REPEAT / UNTIL |
Repeat loop until condition is true |
END UNTIL |
Marks the end of a repeat-until loop |
DO |
Loop body keyword (used with WHILE or UNTIL) |
EXIT WHEN |
Exit loop when condition is met |
DISPLAY / SHOW / PROMPT / SCAN |
Variants of output/input operations |
WRITE LINE / READ LINE |
File or console I/O line operations |
ARRAY / LIST / RECORD / TABLE / STACK / QUEUE |
Data structures |
DECLARE / CONSTANT / VARIABLE / TYPE / OF TYPE |
Declarations of variables, constants, or types |
SET / SET OF |
Set data type or assignment |
BEGIN / START / END |
Block delimiters |
EXIT / BREAK / CONTINUE |
Loop control statements |
COMMENT |
Marks a comment |
WITH / BY |
Used in structured statements (e.g. WITH record BY field) |
DEFAULT / OTHERWISE |
Default branch in CASE statements |
NULL / EMPTY |
Null or empty value |
IS / IN |
Membership or comparison operators |