How to keep appending new values to a list without initiating it after each append

Hereโ€™s the code :

arrr=[0,5,12,150,25]
    added_value=st.number_input("Enter the value of the last element: ",1)
    ladd=st.button('Add to the list ! !')
    if ladd:
        arrr.append(added_value)
    st.write(arrr)

    popping=st.button('Pop the last element out !')
    if popping:
        if arrr!=[]:
            arrr.pop()

The problem here is that each time i add a new value , the previous one would be deleted .
Thanks for your attention .

Iโ€™ve used Session state to solve this problem , is there any alternatives or maybe future updates to make it easier ?
thanks

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.