Vihang28 commited on
Commit
3b0f355
·
1 Parent(s): 079b96c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -55,20 +55,16 @@ def check_palin(check_num):
55
  else:
56
  return("Not Palindrom")
57
 
58
- def create_new(num_lst1,num_lst2):
59
- first_lst = []
60
- sec_lst = []
61
  fin_lst = []
62
- for i in range(num_lst1):
63
- first_lst.append(st.number_input(label="Element of first list: ",value=0))
64
- for j in range(num_lst2):
65
- sec_lst.append(st.number_input(label="Element of first list: ",value=0))
66
- for x in first_lst:
67
- if x % 2 == 1:
68
- fin_lst.append(x)
69
- for y in sec_lst:
70
- if y % 2 == 0:
71
- fin_lst.append(y)
72
  return(fin_lst)
73
 
74
  st.markdown("<h3 style='text-align:center; font-size:24px;'>Mathematical and String Operations</h3>", unsafe_allow_html=True)
@@ -127,9 +123,9 @@ if radio_bar == description6 :
127
 
128
  if radio_bar == description7 :
129
  st.markdown("<h6 style='text-align:center; font-size:16px;'>"+description7+"</h6>", unsafe_allow_html=True)
130
- num_lst1 = st.number_input(label="Enter number of elements in first list:",value=0)
131
- num_lst2 = st.number_input(label="Enter number of elements in second list:",value=0)
132
  all_data = st.button("Check")
133
  if all_data:
134
- result = create_new(num_lst1,num_lst2)
135
  st.success(result)
 
55
  else:
56
  return("Not Palindrom")
57
 
58
+ def create_new(num_str1,num_str2):
 
 
59
  fin_lst = []
60
+ num_lst1 = num_str1.split()
61
+ num_lst2 = num_str2.split()
62
+ for x in num_lst1:
63
+ if int(x) % 2 == 1:
64
+ fin_lst.append(int(x))
65
+ for y in num_lst2:
66
+ if int(y) % 2 == 0:
67
+ fin_lst.append(int(y))
 
 
68
  return(fin_lst)
69
 
70
  st.markdown("<h3 style='text-align:center; font-size:24px;'>Mathematical and String Operations</h3>", unsafe_allow_html=True)
 
123
 
124
  if radio_bar == description7 :
125
  st.markdown("<h6 style='text-align:center; font-size:16px;'>"+description7+"</h6>", unsafe_allow_html=True)
126
+ num_str1 = st.text_input(label="Enter the numbers of first list and seperate each number by single space(' '):",value=0)
127
+ num_str2 = st.text_input(label="Enter the numbers of second list and seperate each number by single space(' '):",value=0)
128
  all_data = st.button("Check")
129
  if all_data:
130
+ result = create_new(num_str1,num_str2)
131
  st.success(result)