Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
|
| 3 |
description1 = "Given two integer numbers, return their product only if the product is equal to or lower than 1000. Otherwise, return their sum."
|
| 4 |
description2 = "Iterate the first 10 numbers, and in each iteration, returns the sum of the current and previous number."
|
| 5 |
-
description3 = "Display characters that are present at an even index number from the provided string"
|
| 6 |
description4 = "Remove the characters from a string starting from zero up to n and returns a new string."
|
| 7 |
description5 = "Returns the number of times a substring is present in the provided string."
|
| 8 |
description6 = "Checks if a number is Palindrom or Not."
|
|
@@ -35,7 +35,12 @@ def even_index(str1):
|
|
| 35 |
if i % 2 == 0 :
|
| 36 |
str_lst.append(str1[i])
|
| 37 |
return(str_lst)
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
st.markdown("<h3 style='text-align:center; font-size:24px;'>Mathematical and String Operations</h3>", unsafe_allow_html=True)
|
| 41 |
st.write("---")
|
|
@@ -63,4 +68,13 @@ if radio_bar == description3 :
|
|
| 63 |
all_data = st.button("Show result")
|
| 64 |
if all_data:
|
| 65 |
result = even_index(str1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
st.success(result)
|
|
|
|
| 2 |
|
| 3 |
description1 = "Given two integer numbers, return their product only if the product is equal to or lower than 1000. Otherwise, return their sum."
|
| 4 |
description2 = "Iterate the first 10 numbers, and in each iteration, returns the sum of the current and previous number."
|
| 5 |
+
description3 = "Display characters that are present at an even index number from the provided string."
|
| 6 |
description4 = "Remove the characters from a string starting from zero up to n and returns a new string."
|
| 7 |
description5 = "Returns the number of times a substring is present in the provided string."
|
| 8 |
description6 = "Checks if a number is Palindrom or Not."
|
|
|
|
| 35 |
if i % 2 == 0 :
|
| 36 |
str_lst.append(str1[i])
|
| 37 |
return(str_lst)
|
| 38 |
+
|
| 39 |
+
def change_str(str2,num2):
|
| 40 |
+
new_srt = ""
|
| 41 |
+
for i in range(num2,len(str2)):
|
| 42 |
+
new_srt = new_srt + str2[i]
|
| 43 |
+
return new_srt
|
| 44 |
|
| 45 |
st.markdown("<h3 style='text-align:center; font-size:24px;'>Mathematical and String Operations</h3>", unsafe_allow_html=True)
|
| 46 |
st.write("---")
|
|
|
|
| 68 |
all_data = st.button("Show result")
|
| 69 |
if all_data:
|
| 70 |
result = even_index(str1)
|
| 71 |
+
st.success(result)
|
| 72 |
+
|
| 73 |
+
if radio_bar == description4 :
|
| 74 |
+
st.markdown("<h6 style='text-align:center; font-size:16px;'>"+description4+"</h6>", unsafe_allow_html=True)
|
| 75 |
+
str2 = st.text_input(label="Enter the string:",value="")
|
| 76 |
+
char_num = st.number_input(label="Number of characters to remove:",value=0)
|
| 77 |
+
all_data = st.button("Show result")
|
| 78 |
+
if all_data:
|
| 79 |
+
result = change_str(str1)
|
| 80 |
st.success(result)
|