Created
November 8, 2014 19:52
-
-
Save RedExplosives/40882c11560a8f31c39e to your computer and use it in GitHub Desktop.
Fahrenheit to Celsius or Celsius to Fahrenheit python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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