44.8k views
0 votes
Write a program to enter a temperature in degrees Fahrenheit and display the equivalent temperature in degrees Centigrade.The formula for conversion: Centigrade = (Fahrenheit – 32) * (5/9)

User EvdB
by
7.9k points

1 Answer

3 votes

Answer:

Here's an example Python program that takes user input for temperature in Fahrenheit and converts it to Celsius using the provided formula:

# Prompt user for temperature in Fahrenheit

fahrenheit = float (input ("Enter temperature in Fahrenheit: "))

# Convert Fahrenheit to Celsius

celsius = (fahrenheit - 32) * (5/9)

# Display result to user

print("Temperature in Celsius: ", celsius)

Here's how the program works:

The input() function prompts the user to enter a temperature in Fahrenheit. The value is converted to a float data type and stored in the variable Fahrenheit.

The formula (fahrenheit - 32) * (5/9) is used to convert the Fahrenheit temperature to Celsius. The result is stored in the variable celsius.The print( ) function displays the result to the user with a descriptive message.

User Mdgrech
by
8.1k points

No related questions found