Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-7163 "Fix: Display weight without trailing zeros" app.py #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion issues/gh-7163/app.py
Original file line number Diff line number Diff line change
@@ -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)