# # Program: temperature.py # Author: James Tam # Version: February 15, 2013 # A program that converts a Celsius temperature to its equivalent in # Fahrenheit. # Learning concepts: # 1) local variables # 2) parameter passing # @ introduction(none) # @returns(nothing) def introduction(): print(""" Celsius to Fahrenheit converter ------------------------------- This program will convert a given Celsius temperature to an equivalent Fahrenheit value. """) # @display(float,float) # @returns(nothing) # Shows but doesn't modify the temperatures. def display(celsius, fahrenheit): print("") print("Celsius value: ", celsius) print("Fahrenheit value:", fahrenheit) # @convert(none) # @returns(nothing) # With a given temperature in Celsius this function will calculate and # display the equivalent Fahrenheit value. def convert(): celsius = float(input("Type in the celsius temperature: ")) fahrenheit = celsius * (9 / 5) + 32 display(celsius, fahrenheit) # @start(none) # @returns(nothing) def start(): introduction() convert() start()