Vihang28 commited on
Commit
18b15b7
·
1 Parent(s): 2be786e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ title = "Mathematical and String Operations"
4
+
5
+ description1 = "Given two integer numbers, return their product only if the product is equal to or lower than 1000. Otherwise, return their sum."
6
+ description2 = "Iterate the first 10 numbers, and in each iteration, returns the sum of the current and previous number."
7
+ description3 = "Display characters that are present at an even index number from the provided string"
8
+ description4 = "Remove the characters from a string starting from zero up to n and returns a new string."
9
+ description5 = "Returns the number of times a substring is present in the provided string."
10
+ description6 = "Checks if a number is Palindrom or Not."
11
+ description7 = "Given two list of numbers, returns a new list such that the new list contains odd numbers from the first list and even numbers from the second list."
12
+ description8 = "Returns multiplication table of the provided number range."
13
+ description9 = "Returns an integer value of base raises to the power of exponent."
14
+
15
+ def sum_of_two(a,b):
16
+ prod = a*b
17
+ sum1 = a+b
18
+ if prod <= 1000 :
19
+ return(prod)
20
+ else:
21
+ return(sum1)
22
+
23
+ st.markdown(f'<h1 style="text-align: center; margin-bottom: 1rem;">{title}</h1>')
24
+ radio_bar = st.radio(options=[description1, description2, description3, description4, description5, description6, description7, description8, description9], label="Select any one.")
25
+ if radio_bar == description1:
26
+ first_num = st.number_input(label="Enter First Number")
27
+ second_num = st.number_input(label="Enter Second Number")
28
+ if st.button("Calculate result"):
29
+ sum_of_two(first_num,second_num)