Take Float input with number_input

Hello,
I am trying to take float as input with the help of number_input but it’s converting it into integer value somehow.

totChol = st.number_input(label=“cholesterol level in mg/dL”,step=1,format="%i")
st.write(totChol)
sysBP = st.number_input(label=“systolic blood pressure”,step=1,format="%.2f")
st.write(sysBP)

I tried this two things but when I use format="%.2f" it shows warning :

Warning: NumberInput value below has type int so is displayed as int despite format string %.2f.

when I use format="%i" it converts it into integer. I want to take input like this : 125.34
How can I do that? @Creators

when step is an integer it assumes integer input. So
try this:
sysBP = st.number_input(label=“systolic blood pressure”,step=1.,format="%.2f")

1 Like

Thank you for replying , It’s working Thanks. :slightly_smiling_face: