Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,15 @@ def demonstrate_for_loop(n):
|
|
21 |
progress = i / n
|
22 |
progress_color = update_progress_bar_color(progress)
|
23 |
|
24 |
-
# Display results
|
25 |
-
st.markdown(f'<div style="background-color:#fffacd; padding:20px; border-radius:10px; box-shadow: 0px 4px 12px rgba(0,0,0,0.1);">'
|
26 |
-
f'<strong>For Loop result:</strong> {result}</div>', unsafe_allow_html=True)
|
27 |
-
|
28 |
# Progress bar
|
29 |
st.progress(progress)
|
30 |
st.markdown(f'<style>.stProgress {{"background-color": "{progress_color}";}}</style>', unsafe_allow_html=True)
|
31 |
|
32 |
time.sleep(0.5) # Simulate execution time
|
|
|
|
|
|
|
|
|
33 |
|
34 |
# Function to demonstrate a while loop with colorful output
|
35 |
def demonstrate_while_loop(n):
|
@@ -43,16 +43,16 @@ def demonstrate_while_loop(n):
|
|
43 |
progress = i / n
|
44 |
progress_color = update_progress_bar_color(progress)
|
45 |
|
46 |
-
# Display results
|
47 |
-
st.markdown(f'<div style="background-color:#fffacd; padding:20px; border-radius:10px; box-shadow: 0px 4px 12px rgba(0,0,0,0.1);">'
|
48 |
-
f'<strong>While Loop result:</strong> {result}</div>', unsafe_allow_html=True)
|
49 |
-
|
50 |
# Progress bar
|
51 |
st.progress(progress)
|
52 |
st.markdown(f'<style>.stProgress {{"background-color": "{progress_color}";}}</style>', unsafe_allow_html=True)
|
53 |
|
54 |
time.sleep(0.5) # Simulate execution time
|
55 |
i += 1
|
|
|
|
|
|
|
|
|
56 |
|
57 |
# Streamlit app layout
|
58 |
st.title("Loop Demonstrator App")
|
|
|
21 |
progress = i / n
|
22 |
progress_color = update_progress_bar_color(progress)
|
23 |
|
|
|
|
|
|
|
|
|
24 |
# Progress bar
|
25 |
st.progress(progress)
|
26 |
st.markdown(f'<style>.stProgress {{"background-color": "{progress_color}";}}</style>', unsafe_allow_html=True)
|
27 |
|
28 |
time.sleep(0.5) # Simulate execution time
|
29 |
+
|
30 |
+
# Display final results
|
31 |
+
st.markdown(f'<div style="background-color:#fffacd; padding:20px; border-radius:10px; box-shadow: 0px 4px 12px rgba(0,0,0,0.1);">'
|
32 |
+
f'<strong>For Loop result:</strong> {result}</div>', unsafe_allow_html=True)
|
33 |
|
34 |
# Function to demonstrate a while loop with colorful output
|
35 |
def demonstrate_while_loop(n):
|
|
|
43 |
progress = i / n
|
44 |
progress_color = update_progress_bar_color(progress)
|
45 |
|
|
|
|
|
|
|
|
|
46 |
# Progress bar
|
47 |
st.progress(progress)
|
48 |
st.markdown(f'<style>.stProgress {{"background-color": "{progress_color}";}}</style>', unsafe_allow_html=True)
|
49 |
|
50 |
time.sleep(0.5) # Simulate execution time
|
51 |
i += 1
|
52 |
+
|
53 |
+
# Display final results
|
54 |
+
st.markdown(f'<div style="background-color:#fffacd; padding:20px; border-radius:10px; box-shadow: 0px 4px 12px rgba(0,0,0,0.1);">'
|
55 |
+
f'<strong>While Loop result:</strong> {result}</div>', unsafe_allow_html=True)
|
56 |
|
57 |
# Streamlit app layout
|
58 |
st.title("Loop Demonstrator App")
|