Skip to content

Instantly share code, notes, and snippets.

@RedExplosives
Created November 8, 2014 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedExplosives/40882c11560a8f31c39e to your computer and use it in GitHub Desktop.
Save RedExplosives/40882c11560a8f31c39e to your computer and use it in GitHub Desktop.
Fahrenheit to Celsius or Celsius to Fahrenheit python
# 11/1/14 Python 3.2
__version__ = '0.1'
# main.py
import time
# Main
def main():
print("This program will convert Fahrenheit to Celsius or Celsius to Fahrenheit")
time.sleep(1)
inputconvert = input("Type fc to convert Fahrenheit to Celsius or type cf to convert from Celsius to Fahrenheit: ")
# fahrenheit to celsius
if inputconvert == "fc":
fahrenheit = float(input("Enter Integer or Float: "))
celsius = (fahrenheit - 32) * 5.0/9.0
print(celsius)
# celsius to fahrenheit
if inputconvert == "cf":
celsius = float(input("Enter Integer or Float: "))
fahrenheit = 9.0/5.0 * celsius + 32
print(fahrenheit)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment