Sunday, October 30, 2011

stupid python 91fahr to 32cels code snippet



run code in console:
$ python ./my-dumb-code.py
##############
cut and paste code:
# python 
# fourmula //::: C = (F - 32) * (5 / 9)
# convert fahrenheit to Celsius   SCRIPT. #
# darn this lame scrip took me forever to guese #
################
print " type 'stop' to end this app and return to python shell"
print " this app converts   Fahrenheit to celsius via loop nesting. "
print " if num is what makes this app WORK!"

#####
## " this app is python 2point6 uses raw inpute "
#####

stop = 'stop'



 

while True:
    reply = raw_input('Type "stop" to exit or 1 to contunue:')
    if reply == 'stop':
        break
    elif not reply.isdigit():
        print('Bad!' * 8)
    else:
        num = int(reply )   ##-32
        if num   :
           f2c = int(raw_input("Please enter the temperature in Fahrenheit you wish to convert: "))
           f2c = (f2c - 32) *5/9 
          # print f 
           print ">> input converter to cels ="
           print  f2c
        #     print('low')
        # else:
        #  print(num ) 
     
print('Bye')

python fahrenheit to celsius.
NOTES::
//°C to °F Farenheit = (9/5)* celsius + 32
//°C to °F Multiply by 9, then divide by 5, then add 32
//// °F to °C Deduct 32, then multiply by 5, then divide by 9
// (fahr -32) * (5.0/9.0)

No comments: