I'm writing a simple algorithm to convert between degrees Celsius and degrees Fahrenheit the rest of the algorithm works perfectly so long as input for tu is limited to either "F" or "C". however I want to actually prevent users from entering anything but those strings.
I want to replace the commented area with something that will trigger the error message and sys.exit()
import sys
t = 0.0
tu = "null"
print "This program will convert between degrees C and F."
print "Input temperature unit. (F or C)"
tu = raw_input()
#if (tu != "F" and != "C"):
#print "The directions were clear, try again."
#sys.exit()
Even input that should be allowed triggers the sys.exit(). I obviously don’t want that.