Write a Python program called Temperatures that has two tasks:

A. Allows the user to convert a temperature given in degrees from either Celsius to Fahrenheit or Fahrenheit to Celsius. Use the following formulas:

• Celsius = 5 * (Fahrenheit − 32) / 9

• Fahrenheit = (9 * (Celsius) / 5) + 32

• Prompt the user to enter a temperature and either a C or c for Celsius or an F or f for Fahrenheit.

• Convert the temperature to Fahrenheit if Celsius is entered or Celsius if Fahrenheit is entered.

• Display the result in a readable format.

• If anything, other than C, c, F, or f is entered, print an error message and ask for the correct entry again

Answer :

The program will convert the temperature to Fahrenheit using the formula `(9 * 30 / 5) + 32`, resulting in 86°F. It will then display the result as "The temperature in Fahrenheit is 86°F".

Python program called "Temperatures" that performs the specified tasks.

```python
# Prompt the user to enter a temperature and temperature unit
temperature = float(input("Enter the temperature: "))
unit = input("Enter the unit (C or c for Celsius, F or f for Fahrenheit): ")

# Convert the temperature based on the unit entered
if unit.lower() == "c":
# Convert Celsius to Fahrenheit
fahrenheit = (9 * temperature / 5) + 32
print(f"The temperature in Fahrenheit is {fahrenheit}°F")
elif unit.lower() == "f":
# Convert Fahrenheit to Celsius
celsius = 5 * (temperature - 32) / 9
print(f"The temperature in Celsius is {celsius}°C")
else:
# Handle incorrect input
print("Error: Please enter C, c, F, or f for the unit")

```

1. The program starts by prompting the user to enter a temperature and the unit of that temperature.


2. The temperature is stored as a float variable, and the unit is stored as a string variable.


3. The program then checks the value of the unit variable using an if-elif-else statement.


4. If the unit is "C" or "c", the program converts the temperature from Celsius to Fahrenheit using the formula `(9 * temperature / 5) + 32`. The result is stored in the variable `fahrenheit`.


5. If the unit is "F" or "f", the program converts the temperature from Fahrenheit to Celsius using the formula `5 * (temperature - 32) / 9`. The result is stored in the variable `celsius`.


6. If the unit is none of the specified options, the program prints an error message and asks the user to enter the correct unit.


7. Finally, the program displays the converted temperature in a readable format by printing the result using formatted strings.

Example:
Let's say the user enters a temperature of 30 and the unit as "C". The program will convert the temperature to Fahrenheit using the formula `(9 * 30 / 5) + 32`, resulting in 86°F. It will then display the result as "The temperature in Fahrenheit is 86°F".
To more about Fahrenheit visit:

https://brainly.com/question/516840

#SPJ11