crh23

Forty Below In The Winter

Sep 2nd, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def FtoC(F):
  2.    C = (F - 32) * (5 / 9)
  3.    return C
  4. def CtoF(C):
  5.    F = C * (9 / 5) + 32
  6.    return F
  7. inStr = input()
  8. num = float(inStr[0:len(inStr) - 1])
  9. if inStr[-1] == "C":
  10.    print(str(CtoF(num)) + "F")
  11. if inStr[-1] == "F":
  12.    print(str(FtoC(num)) + "C")
Advertisement
Add Comment
Please, Sign In to add comment