talha515 commited on
Commit
73afa5b
·
verified ·
1 Parent(s): e0efe60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Title of the app
4
+ st.title("Temperature Converter 🌡️")
5
+
6
+ # Sidebar for user input
7
+ st.sidebar.title("Convert Temperature")
8
+ conversion_type = st.sidebar.radio("Select conversion type:", ["Celsius to Fahrenheit", "Fahrenheit to Celsius"])
9
+
10
+ # Input field
11
+ temp_input = st.sidebar.number_input("Enter the temperature:", value=0.0, format="%.2f")
12
+
13
+ # Conversion logic
14
+ if conversion_type == "Celsius to Fahrenheit":
15
+ converted_temp = (temp_input * 9/5) + 32
16
+ st.write(f"**{temp_input}°C** is equal to **{converted_temp:.2f}°F**")
17
+ elif conversion_type == "Fahrenheit to Celsius":
18
+ converted_temp = (temp_input - 32) * 5/9
19
+ st.write(f"**{temp_input}°F** is equal to **{converted_temp:.2f}°C**")
20
+
21
+ # Footer
22
+ st.sidebar.write("---")
23
+ st.sidebar.write("Developed with ❤️ using Streamlit")