import streamlit as st # Title and Description st.title("Temperature Conversion App") st.markdown("Convert temperatures between Celsius and Fahrenheit.") # Input Temperature temp_input = st.number_input("Enter the temperature to convert:", format="%.2f") # Conversion Option conversion_type = st.radio( "Select conversion type:", ("Celsius to Fahrenheit", "Fahrenheit to Celsius"), ) # Conversion Logic if conversion_type == "Celsius to Fahrenheit": converted_temp = (temp_input * 9/5) + 32 st.write(f"{temp_input:.2f}°C is equal to {converted_temp:.2f}°F.") elif conversion_type == "Fahrenheit to Celsius": converted_temp = (temp_input - 32) * 5/9 st.write(f"{temp_input:.2f}°F is equal to {converted_temp:.2f}°C.")