|
|
import streamlit as st |
|
|
|
|
|
|
|
|
planet_gravity = { |
|
|
"Mercury": 0.38, |
|
|
"Venus": 0.91, |
|
|
"Earth": 1.00, |
|
|
"Moon": 0.166, |
|
|
"Mars": 0.38, |
|
|
"Jupiter": 2.34, |
|
|
"Saturn": 1.06, |
|
|
"Uranus": 0.92, |
|
|
"Neptune": 1.19, |
|
|
"Pluto": 0.06 |
|
|
} |
|
|
|
|
|
|
|
|
st.set_page_config(page_title="Planetary Weight Calculator π", layout="centered") |
|
|
st.title("π Planetary Weight Calculator") |
|
|
st.write("Enter your weight on Earth and find out how much you'd weigh on other celestial bodies!") |
|
|
|
|
|
|
|
|
earth_weight = st.number_input("Enter your weight on Earth (in kg):", min_value=1.0, step=0.5) |
|
|
|
|
|
if earth_weight: |
|
|
planet = st.selectbox("Select a planet or celestial body:", list(planet_gravity.keys())) |
|
|
calc_button = st.button("Calculate Weight") |
|
|
|
|
|
if calc_button: |
|
|
new_weight = earth_weight * planet_gravity[planet] |
|
|
st.success(f"Your weight on **{planet}** would be **{new_weight:.2f} kg** πͺ") |
|
|
|
|
|
st.markdown("---") |
|
|
st.markdown("Created with β€οΈ using Streamlit. Ready for space travel? π") |
|
|
|