DOMMETI commited on
Commit
fb64e36
·
verified ·
1 Parent(s): f6411d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -21
app.py CHANGED
@@ -46,25 +46,31 @@ the key points of descriptive statistics are stated below.\n KEY COCEPTS\n * Mea
46
  st.subheader("Measure Of Central Tendency",divider=True)
47
  st.markdown("""The measure of central tendency is used to find the central average value of the data.The central tendency can be computed by
48
  useing three ways \n * Mode \n * Median \n * Mean""")
49
- def mode(list1):
50
- dict1={}
51
- dict2={}
52
- set1=set(list1)
53
- for i in list1:
54
- for j in set1:
55
- dict1[j]=list1.count(j)
56
- max_value=max(dict1.values())
57
- count = [key for key, value in dict1.items() if value==max_value]
58
- if max_value==1:
59
- print('no mode')
60
- elif len(count)==len(set1):
61
- print('no mode')
62
- elif len(count)==1:
63
- dict2[count[0]]= dict1.get(count[0])
64
- print(dict2)
65
- elif len(count)==2:
66
- print('bi mode')
67
- elif len(count)==3:
68
- print('tri mode')
69
  else:
70
- print('multimode')
 
 
 
 
 
 
 
46
  st.subheader("Measure Of Central Tendency",divider=True)
47
  st.markdown("""The measure of central tendency is used to find the central average value of the data.The central tendency can be computed by
48
  useing three ways \n * Mode \n * Median \n * Mean""")
49
+ def mode(*args):
50
+ list1 = list(args)
51
+ dict1 = {}
52
+ dict2 = {}
53
+ set1 = set(list1)
54
+ for j in set1:
55
+ dict1[j] = list1.count(j)
56
+ max_value = max(dict1.values())
57
+ count = [key for key, value in dict1.items() if value == max_value]
58
+ if max_value == 1:
59
+ return 'no mode'
60
+ elif len(count) == len(set1):
61
+ return 'no mode'
62
+ elif len(count) == 1:
63
+ dict2[count[0]] = dict1.get(count[0])
64
+ return dict2
65
+ elif len(count) == 2:
66
+ return 'bi mode'
67
+ elif len(count) == 3:
68
+ return 'tri mode'
69
  else:
70
+ return 'multimode'
71
+
72
+ # Call the mode function with specific arguments
73
+ result = mode(1, 2, 3, 3, 3)
74
+
75
+ # Display the result
76
+ st.write("Mode result:", result)