Update app.py
Browse files
app.py
CHANGED
|
@@ -42,6 +42,13 @@ def change_str(str2,num2):
|
|
| 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("---")
|
| 47 |
radio_bar = st.sidebar.radio(options=[description1, description2, description3, description4, description5, description6, description7, description8, description9], label="Select any one:")
|
|
@@ -77,4 +84,13 @@ if radio_bar == description4 :
|
|
| 77 |
all_data = st.button("Show result")
|
| 78 |
if all_data:
|
| 79 |
result = change_str(str2,char_num)
|
| 80 |
-
st.success(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
new_srt = new_srt + str2[i]
|
| 43 |
return new_srt
|
| 44 |
|
| 45 |
+
def str_count(str3,sub_str):
|
| 46 |
+
str3 = str3.lower()
|
| 47 |
+
sub_str = sub_str.lower()
|
| 48 |
+
x = new_str3.count(new_sub_str)
|
| 49 |
+
return x
|
| 50 |
+
|
| 51 |
+
|
| 52 |
st.markdown("<h3 style='text-align:center; font-size:24px;'>Mathematical and String Operations</h3>", unsafe_allow_html=True)
|
| 53 |
st.write("---")
|
| 54 |
radio_bar = st.sidebar.radio(options=[description1, description2, description3, description4, description5, description6, description7, description8, description9], label="Select any one:")
|
|
|
|
| 84 |
all_data = st.button("Show result")
|
| 85 |
if all_data:
|
| 86 |
result = change_str(str2,char_num)
|
| 87 |
+
st.success(result)
|
| 88 |
+
|
| 89 |
+
if radio_bar == description5 :
|
| 90 |
+
st.markdown("<h6 style='text-align:center; font-size:16px;'>"+description5+"</h6>", unsafe_allow_html=True)
|
| 91 |
+
str3 = st.text_input(label="Enter the string:",value="")
|
| 92 |
+
sub_str= st.text_input(label="Enter the sub-string:",value="")
|
| 93 |
+
all_data = st.button("Show result")
|
| 94 |
+
if all_data:
|
| 95 |
+
result = str_count(str3,sub_str)
|
| 96 |
+
st.success(f"The sub-string is present {result} times in the string")
|