From 8a86418609df82dbdaea84d7096eb2a421ea9c6a Mon Sep 17 00:00:00 2001 From: "Raghul Rajkumar.R" <98071322+RRaghulRajkumar@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:37:08 +0530 Subject: [PATCH] "Fix: Display weight without trailing zeros" app.py --- issues/gh-7163/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/issues/gh-7163/app.py b/issues/gh-7163/app.py index b54742f..9a565f4 100644 --- a/issues/gh-7163/app.py +++ b/issues/gh-7163/app.py @@ -1,7 +1,11 @@ import streamlit as st + with st.expander("Weight Loss", expanded=True): weight_goal = 200 initial_weight = 275.0 - todays_weight = st.number_input("Current Weight", value=initial_weight, min_value=170.0, max_value=280.0, step=0.2, help ="Goal is 200.") + todays_weight = col1.number_input("Current Weight", value=initial_weight, min_value=170.0, max_value=280.0, step=0.2, help="Goal is 200.") +# Convert the float to a formatted string without trailing zeros +formatted_weight = f"{todays_weight:.1f}" # Display up to 1 decimal place +st.write("Formatted Weight:", formatted_weight)