nothing special, yet another tech blog, focus on software testing, python, telephony, sql and few other random stuff that grabs my attention...
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#it will provide a introduction to the program print('''Welcome to Temperature Convertor. \nYou can convert between 'A. Celsius to Fahrenheit', and 'B. Fahrenhet to Celcius''') #we're defining a converter function def convertr(): #capturing the choice selectconv = raw_input(''' Press A to convert Celcius to Fahrenheit \n Press B to convert Fahrenheit to Celcius ''') #if A is selected if selectconv ==("A") or selectconv == ("a"): #collecting celcius value celcius = int(raw_input("please enter temperature to convert from celcius to fahrenheit")) #making the calculation fahrenheit = 9.0/5.0 * celcius + 32 #printing the converted value print "the converted %f celcius is %f fahrenheit" %(celcius,fahrenheit) #if B is selected elif selectconv ==("B") or selectconv == ("b"): #collecting fahrenheit value fahrenheit = int(raw_input("please enter temperature to convert from fahrenheit to celcius")) #making the calculation celcius = (5.0/9.0) * (fahrenheit - 32) #printing the converted value print "the converted %f fahrenheit is %f celcius" %(fahrenheit, celcius) else: #letting the user know if they didnt make proper choice print("please make a choice") convertr() #here we are performing the loop to ask if the program need to be executed again def loop(): restartprgm = raw_input("Do you want to try again?") while restartprgm == ("Yes") or restartprgm == ("yes") or restartprgm == ("YES") or restartprgm == ("Y") or restartprgm == ("y"): return convertr() else: while restartprgm == ("No") or restartprgm == ("no") or restartprgm == ("NO"): print ("see you later") exit() loop() |
Previous Post
Next Post
Pingback: http://discountcarautoinsurance.com
Pingback:
Pingback: http://datapad.info
Pingback: where to get a free credit report
Pingback: Check These Guys Out
Pingback: Book of Ra
Pingback: lantaarn-winkel.nl
Pingback: Book of Ra
Pingback: Electrician Melbourne
Pingback: cheapautocarinsurancequotes.org
Pingback: Clarendon Hills IL
Pingback: resource
Pingback: low cost auto insurance program
Pingback: credit voiture
Pingback: bottom