The word pseudo can be used to imply that something is apparent i.e looks actual but not so. A pseudocode , therefore, means that the code is not an actual computer code. This is somehow accurate because pseudocodes are not written for computer's to execute, they are instead used to provide a high-level description of a program usually in a natural language like English.
The purpose of pseudocodes is to help a programmer or a user understand the program better. They can be used in program's documentation to offer a description of the program and it's algorithm in a way friendly to a human interacting with it.
pseudocodes are especially helpful for educational purposes because they are easy to understand for beginners than actual computer codes.
Let us look at a simple pseudocode for a computer program that is meant to take two numerical inputs from a user, have the computer calculate the sum of the two numbers and then display the answer .
Input
display a message requesting the user to enter the first number
get the first number from the keyboard
display a message requesting the user to enter the second number
get the second number from the keyboard
Processing
calculate the sum of the two numbers entered above
Output
display the answer on the screen
pseudocodes in real programming use more structured language than the one we used above , for example the above pseudocode might look like:
input a
number1 ← a
input b
number2 ← b
sum ← number1 + number2
print sum
The left arrow is used to show assignment
After writing the pseudocode , the task being solved by the program becomes apparent and we can now code it's logic in a real programming language. For example the pseudocode above written in python might look like.
#input
number1 = input("Enter the first number:")
number2 = input("Enter the second number:")
#processing
answer = int(number1) + int(number2)
#output
print(answer)
A pseudocodes to find average given two numbers
input a
number1 ← a
input b
number2 ← b
total ← number1 + number2
average ← total / 2
print average
The same above program in python might look like:
num1 = input("Enter first number:")
num2 = input(" enter second number:")
total = int(num1) + int( num2 )
average = total / 2
print( average )
Pseudocodes are written with one goal in mind i.e to help a human understand a particular program's operation better.