

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
What pseudocode is, its benefits, and provides examples of pseudocode in action using python. Pseudocode is a simplified, half-english, half-code outline of a computer program that helps clarify thoughts, design routines, make reviews easier, support iterative refinement, make changes easier, and minimize commenting effort. It also shows how to convert pseudocode into real code.
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


What is pseudocode? Pseudocode is a simplified, half-English, half-code outline of a com- puter program.
Why use it?
Now let’s look at some examples of pseudocode in action!
Variables: price of item, sales tax rate, sales tax, final price Note that the operations are numbered and each operation is unambiguous and effectively computable. We also extract and list all variables used in our pseudo-code. This will be useful when translating pseudo-code into a programming language. Now let’s turn this pseudocode into real code. We start by making our pseudocode into Python comments; then, we ”fill in the blanks” under each line of pseudocode, filling it with real code (sometimes one line of pseudocode may represent more than one line of real code).
def compute_salestax():
price = float(raw_input("What is the item's price? ")
tax_rate = float(raw_input("Enter the sales tax rate, in decimal: ")
tax = price * tax_rate
final_price = price + tax
print "The final price is:", final_price
return