Skip to content

Instantly share code, notes, and snippets.

@anthonygclark
Created November 1, 2015 19:25
Show Gist options
  • Save anthonygclark/550089af00ed603b8ace to your computer and use it in GitHub Desktop.
Save anthonygclark/550089af00ed603b8ace to your computer and use it in GitHub Desktop.
# using lambdas
#
c_to_f = lambda c: (c * (9.0/5.0)) + 32
f_to_c = lambda f: (f - 32) * (5.0/9.0)
print "Equality check: ", c_to_f(-40) == f_to_c(-40)
# using function
#
def CelsiusToFahrenheit(c):
return (c * 9.0/5.0) + 32
def FahrenheitToCelsius(f):
return (f - 32) * (5.0/9.0)
print "Equality check: ", CelsiusToFahrenheit(-40) == FahrenheitToCelsius(-40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment