To create a Python script converter for Celsius and Fahrenheit, we need to understand the formula first-

Fahrenheit to Celsius Formula:

°C =  (°F – 32) x 5/9

Celsius to Fahrenheit Formula:

°F = (9/5)*°C  +  32

You can use below code to create the script and name it as FtoC.py or CtoF.py and execute using python.

Script to convert Celsius to Fahrenheit:

celsius = float(raw_input(“Enter the temperature in Celsius: “));
Fahrenheit = (9.0/5.0)*celsius + 32.0;
print ‘The temperature in Fahrenheit:’, Fahrenheit;

image

Script to convert Fahrenheit to Celsius:

Fahrenheit = float(raw_input(“Enter the temperature in Fahrenheit: “));
Celsius = (5.0/9.0)*(Fahrenheit  – 32.0);
print ‘The temperature in Celsius:’, Celsius;

image