Expand|Select|Wrap|Line Numbers
- #!/usr/bin/python
- # A program developed to see if the temperature is Celcius or Farhenheit
- # and than convert it to the other in a more user friendly manner
- import os, sys
- import math
- def far(temp):
- Celcius = ((temp - 32) * 5) / 9
- Kelvin = Celcius + 273.15
- def cel(temp):
- Far = (temp * 1.8) + 32
- Kelvin = temp + 273.15
- def kelvin(temp):
- Celcius = temp + 273.15
- Far = (Celcius * 1.8) + 32
- human = raw_input("Is your temperature in Fahrenheit (f), Celcius (c), or Kelvin (k) --> ")
- temp1 = int(raw_input("What is your temperature --> ")
- if human=="f":
- far(temp1)
- print "Your temperature is %s in Celcius and %s in Kelvin" % Celcius,Kelvin
- if human=="c":
- cel(temp1)
- print "Your temperature is %s in Fahrenheit and %s in Kelvin" % Far,Kelvin
- if human=="k":
- kelvin(temp1)
- print "Your temperature is %s in Celcius and %s in Fahrenheit" % Celcius,Far
Expand|Select|Wrap|Line Numbers
- File "temp2.py", line 28
- if human=="f":
- ^
- SyntaxError: invalid syntax