Update app.py
Browse files
app.py
CHANGED
|
@@ -63,18 +63,20 @@ if sidebar_option == "Introductory Tutorial":
|
|
| 63 |
image = Image.open("1.png") # Path to your image file
|
| 64 |
st.image(image, width=200) # You can adjust the width as needed
|
| 65 |
|
|
|
|
| 66 |
# Add the Bubble Sort Simulator button
|
| 67 |
if st.button("Bubble Sort Simulator"):
|
| 68 |
st.title("Bubble Sort with Animation")
|
| 69 |
|
| 70 |
# Get input array from user
|
| 71 |
user_input = st.text_input("Enter the array elements separated by spaces:")
|
| 72 |
-
|
|
|
|
| 73 |
if user_input:
|
| 74 |
arr = list(map(int, user_input.split()))
|
| 75 |
|
| 76 |
# Ask the user if they want an animation
|
| 77 |
-
animate_option = st.radio("Do you want to see the animation?", options=["Yes", "No"])
|
| 78 |
|
| 79 |
# Perform bubble sort and get the steps for animation
|
| 80 |
animate = animate_option == "Yes"
|
|
|
|
| 63 |
image = Image.open("1.png") # Path to your image file
|
| 64 |
st.image(image, width=200) # You can adjust the width as needed
|
| 65 |
|
| 66 |
+
# Add the Bubble Sort Simulator button
|
| 67 |
# Add the Bubble Sort Simulator button
|
| 68 |
if st.button("Bubble Sort Simulator"):
|
| 69 |
st.title("Bubble Sort with Animation")
|
| 70 |
|
| 71 |
# Get input array from user
|
| 72 |
user_input = st.text_input("Enter the array elements separated by spaces:")
|
| 73 |
+
|
| 74 |
+
# Check if array input exists and the animation option is available
|
| 75 |
if user_input:
|
| 76 |
arr = list(map(int, user_input.split()))
|
| 77 |
|
| 78 |
# Ask the user if they want an animation
|
| 79 |
+
animate_option = st.radio("Do you want to see the animation?", options=["Yes", "No"], key="animate_radio")
|
| 80 |
|
| 81 |
# Perform bubble sort and get the steps for animation
|
| 82 |
animate = animate_option == "Yes"
|