Hi all, I'm new to Python (and programming in general) and need some help!
Here is my code so far for a temperature conversion program (converts between Fahrenheit and Celsius): temp = input("Enter A Number : ") convertTo = raw_input("Convert To (F)ahrenheit or (C)elsius? : ") if convertTo == "F": convertedTemp = convertToFahrenheit(temp) print "%d Celsius = %d Fahrenheit" % (temp, convertedTemp) else: convertedTemp = convertToCelsius(temp) print "%d Fahrenheit = %d Celsius" % (temp, convertedTemp) def convertToFahrenheit(t): tF = (9.0/5.0) * (t + 32) return tF def convertToCelsius(t): tC = (9.0/5.0) * (t - 32) return tC It worked fine without having extra functions but once I put convertToFahrenheit and convertToCelsius in (just for practice really), this happened: Enter A Number : 50 Convert to (F)ahrenheit or (C)elsius? : F Traceback (most recent call last): File "TemperatureConverter.py", line 5, in <module> convertedTemp = convertToFahrenheit(temp) NameError: name 'convertToFahrenheit' is not defined This is most likely a very simple error, but can someone please clarify for me why it's behaving this way? Thanks! Joe
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor