Sequence and Assignment
The following algorithm shows the use of sequence (processing instructions one after the other) and assignment (setting a value for a variable using the assignment operator, '='):
BEGIN simpleInterest SET interestRate = 0.05 SET timeYears = 2 INPUT principal CALCULATE interest = interestRate * timeYears * principal OUTPUT "total interest is" interest END simpleInterest
Python's readability is very similiar to pseudocode, as the Python language does not contain confusing syntax:
simpleInterest.py
#BEGIN simpleInterest interestRate = 0.05 #SET interestRate = 0.05 timeYears = 2 #SET timeYears = 2 principal = int(input("principal ($): ")) #INPUT principal interest = interestRate * timeYears * principal #CALCULATE interest = interestRate * timeYears * principal print("total interest is", interest) #OUTPUT interest #END simpleInterest