[Tutor] celcius to farenheit converter.

python at uni-code.com python at uni-code.com
Wed Apr 18 06:34:01 CEST 2007


I found this site and I'm practicing coding and I write this script, but
I'm unsure why its not working.  Everything goes well until it gets to the
part where it tries to calculate the formula.  Inputs work fine anyone
know what I did wrong?

###################################
#Temperature Converter
#Coding Practice for lamonte(uni-code.com)
###################################

temp = raw_input("Insert a temperature to convert.\n")

type = raw_input("Now choose a convertion: Celcius(c) or Farenheit(f)")

if type == "c":
	cel = (5/9)*(temp-32)
	print "Farhrenheit" +temp+" is equal to "+cel+" celcius.\n"
elif type == "f":
	far = (9/5)*(temp+32)
	print "Farhrenheit" +far+" is equal to "+temp+" celcius.\n"
else:
	print "Unknown Syntax!\n";

raw_input("\nPress enter to close program")


More information about the Tutor mailing list