DOMMETI commited on
Commit
d20bcc3
·
verified ·
1 Parent(s): 10d7f66

Update pages/Measurement_of_disperssion.py

Browse files
Files changed (1) hide show
  1. pages/Measurement_of_disperssion.py +27 -13
pages/Measurement_of_disperssion.py CHANGED
@@ -28,21 +28,35 @@ st.subheader("Relative Range")
28
  st.latex(r'''
29
  \text{Relative Range} = \frac{\text{Absolute Range}}{\text{Mean}} \times 100
30
  ''')
 
 
 
31
  def absolute_range(list1):
32
- max=np.max(list1)
33
- min=np.min(list1)
34
- return max-min
 
35
  st.title("Calculate Range")
36
- num_input=st.text_input("Enter the values with seperated comma 1,2,3,4",key="num_input")
37
- value=num_input.split(",")
38
- list1=[]
39
- for i in value:
40
- if i.isdigit():
41
- list1.append(int(i))
42
- else:
43
- pass
44
- result=absolute_range(list1)
45
- st.write("Absolute_Range",result)
 
 
 
 
 
 
 
 
 
 
46
  st.markdown(''':orange[**Quartile Deviation**] is one of the measure to find the disperssion.In this type the data is divided into 4 equal parts.
47
  It will mostly focus on the central data.
48
  ''')
 
28
  st.latex(r'''
29
  \text{Relative Range} = \frac{\text{Absolute Range}}{\text{Mean}} \times 100
30
  ''')
31
+ import streamlit as st
32
+ import numpy as np
33
+
34
  def absolute_range(list1):
35
+ max_val = np.max(list1)
36
+ min_val = np.min(list1)
37
+ return max_val - min_val
38
+
39
  st.title("Calculate Range")
40
+
41
+ num_input = st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input")
42
+
43
+ # Initialize list1 to handle the case when num_input is empty
44
+ list1 = []
45
+
46
+ # Process the input only if it's not empty
47
+ if num_input:
48
+ value = num_input.split(",")
49
+ for i in value:
50
+ if i.isdigit():
51
+ list1.append(int(i))
52
+
53
+ # Check if list1 is not empty and calculate the range
54
+ if list1:
55
+ result = absolute_range(list1)
56
+ st.write("Absolute Range:", result)
57
+ else:
58
+ st.write("Please enter valid numbers.")
59
+
60
  st.markdown(''':orange[**Quartile Deviation**] is one of the measure to find the disperssion.In this type the data is divided into 4 equal parts.
61
  It will mostly focus on the central data.
62
  ''')