103k views
2 votes
►Write

a python program that will convert Fahrenheit Temperature to Celsius and
Celsius Temperature to Fahrenheit

►Formulae
needed:


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


►°F
= (°C × 9/5) + 32

1 Answer

9 votes

Answer:

import math

C_or_F = input("Enter C for Celcius or F for Farenheit: ")

if C_or_F == 'F':

F = int(input("Enter degrees in Fahrenheit: "))

Fahrenheit =(F-32)*(5/9)

print(Fahrenheit,"°")

if C_or_F == 'C':

C = int(input("Enter degrees in Celcius: "))

Celcius = (C*(9/5))+32

print (Celcius,"°")

Step-by-step explanation:

The first input determines if it is Fahrenheit or Celcius. The second inputs determine how many degrees in that unit of temperature.

User Facundo Corradini
by
8.2k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.