Output getting over-written on using st.beta_coloumns

Hi ,Totally a beginner here, I have successfully made clickable buttons. However when i click on the second button for example Total Distance covered ,it overrides the value of Average Speed In km/hr and same behavior is observed while clicking the other buttons.

Code :

  import streamlit as st
  average_velocity = 20 
  Total_distance_covered = 90
  Takeoff_angle = 75
  Landing_angle = 46
  col1, col2, col3, col4 = st.beta_columns(4)
  c1 = ['a', 'b']
  c2 = ['c', 'd']
  c3 = ['e','f']
  c4 = ['g','h']

  if col1.button("Average Speed In Km/hr", c1):
      st.write(average_velocity)

  if col2.button("Total Distance covered in meters",c2):
      st.write(Total_distance_covered)
  if col3.button("Take off angle",c3):
      st.write(Takeoff_angle)
  if col4.button("Landing angle",c4):
      st.write(Landing_angle)

The layout looks as following

Hi @Basic_Visual, welcome to the Streamlit community!

Note that with your code, your st.write are all referring to the default container. If you want to write to a specific column / don’t want things to be overwritten, you need to use the with context manager. See the example here:

Best,
Randy