Thursday, January 14, 2010

pseudocode

pseudocode is precise english language that is used to describe what a computer program does. this helps programers to communicate algorithms without the extra metal effort of creating the code for the program.
for example, a program for temperature conversion could be written in pseudocode as follows:

1) Input the temperature in degrees Celsius
2) Calculate Fahrenheit as (9/5)celsius + 32
3)Output Fahrenheit

Translating the pseudocode to Python gives the following:

def main( )
      celsius = input ("What is the Celsius temperature?")
      fahrenheit = (9.0 / 5.0) * celsius +32
      print "The temperature is", fahrenheit, "degrees fahrenheit"

main( )