Showing posts with label snippet. Show all posts
Showing posts with label snippet. Show all posts

Sunday, October 30, 2011

python loop 33cels to 91fahr

more stupid python code snippets from me by gleeming crap on the interwebs.

# convert Celsius to fahrenheit SCRIPT. #

print " type 'stop' to end this app and return to python shell"
print " this app converts celsius to Fahrenheit via loop nesting. "
print " if num line is what makes this app WORK!"

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

stop = 'stop'

###
#c = 33
#f = (reply)*9/5 + 32
#print (c), "degrees (c) celsius " "= " ,(f), "degrees (f) Fahrenheit  "
###

# f = (num)*9/5 + 32 

while True:
    reply = raw_input('Enter your text number now:')
    if reply == 'stop':
        break
    elif not reply.isdigit():
        print('Bad!' * 8)
    else:
        num = int(reply ) *9/5 + 32
        if num   :
        #     print('low')
        # else:
          print(num ) 
     
print('Bye')

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)