If you get used to read the temperature in Fahrenheit scale like me, you may be confusing to see the temperature in Celsius scale given in weather forcasting on Australian or New Zealand televisions.
So today, I’m gonna show you a small Python program which can be used to convert the temperature scale from Fahrenheit to Celsius. As my Python programming skill is very limited at the moment, the program is going to perform very basic function.
As usual, open your text editor program, copy or type the following code and save it to
A program to convert the Celcius to Fahrenheit scale
def main():<br /> celsius = int(raw_input("What is the Celsius temperature? "))<br /> fahrenheit = 9.0 / 5.0 * celsius + 32<br /> print "The temperature is ", fahrenheit, " degrees Fahrenheit."<br /> main()
Here is an example:
kenno$ python convertctof.py<br /> What is the Celsius temperature? 22<br /> The temparature is 71.6 degrees Fahrenheit.<br />