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')

No comments: