Spaces:
Sleeping
Sleeping
File size: 7,224 Bytes
f904ecf f09626a f904ecf ae2b430 5927245 f5cd890 30efb6e f5cd890 ed77714 f5cd890 ab7c992 1434d29 ab7c992 30efb6e 71d19e8 d30ed8a abd02bd 1434d29 30efb6e 1434d29 30efb6e 1434d29 e32063e 46e881c 7b2ef34 30efb6e 0f50859 7b2ef34 0f50859 04a32a4 0f50859 a081651 30efb6e a081651 8beb3d6 92b0271 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
st.markdown("""
<style>
/* Set a soft background color */
body {
background-color: #eef2f7;
}
/* Style for main title */
h1 {
color: #00FFFF;
font-family: 'Roboto', sans-serif;
font-weight: 700;
text-align: center;
margin-bottom: 25px;
}
/* Style for headers */
h2 {
color: #FFFACD;
font-family: 'Roboto', sans-serif;
font-weight: 600;
margin-top: 30px;
}
/* Style for subheaders */
h3 {
color: #ba95b0;
font-family: 'Roboto', sans-serif;
font-weight: 500;
margin-top: 20px;
}
.custom-subheader {
color: #00FFFF;
font-family: 'Roboto', sans-serif;
font-weight: 600;
margin-bottom: 15px;
}
/* Paragraph styling */
p {
font-family: 'Georgia', serif;
line-height: 1.8;
color: #FFFFFF; /* Darker text color for better visibility */
margin-bottom: 20px;
}
/* List styling with checkmark bullets */
.icon-bullet {
list-style-type: none;
padding-left: 20px;
}
.icon-bullet li {
font-family: 'Georgia', serif;
font-size: 1.1em;
margin-bottom: 10px;
color: #FFFFF0; /* Darker text color for better visibility */
}
.icon-bullet li::before {
content: "✔️";
padding-right: 10px;
color: #b3b3ff;
}
/* Sidebar styling */
.sidebar .sidebar-content {
background-color: #ffffff;
border-radius: 10px;
padding: 15px;
}
.sidebar h2 {
color: #495057;
}
</style>
""", unsafe_allow_html=True)
st.title("EVENTS")
st.markdown("""Events are classified into the below gievn types
<ul class="icon-bullet">
<li>Simple Event</li>
<li>Compound Event</li>
<li>Impossible Event</li>
<li>Independent Events</li>
<li>Dependent Events</li>
<li>Exclusive Events</li>
<li>Certain Events</li>
""",unsafe_allow_html=True)
st.subheader("SIMPLE EVENT")
st.markdown("""An event is said to be a simple event when the outcome of an event is 1.
""",unsafe_allow_html=True)
st.title("Example of Simple Event")
st.write("""
This simple experiment will tell you Simple Event when you click button
""")
Trail_5 = st.number_input("Number of Trials:", min_value=1, max_value=100, value=7,key="Trail_5")
if st.button('Start the Experiment: Will it Rain or Not?',key="start_experiment_4"):
st.write(f"Running {Trail_5} trials...")
list1=[]
for i in range(1, Trail_5 + 1):
result = random.choice(['Rain', 'No Rain'])
list1+=[result]
p_rain_1=1/len(np.unique(list1))
p_no_rain_1=1/len(np.unique(list1))
st.write(f"Event_1:Probability of having rain:{p_rain_1}")
st.write(f"Event_1:Probability of having no_rain:{p_no_rain_1}")
st.write(f"From the above example we can say that the simple event is giving only 1 outcome.")
st.subheader("COMPOUND EVENT")
st.markdown("An event is said to be a compoud event when an event gives more than on event.",unsafe_allow_html=True)
st.title("Example of Compound Event")
st.write("""
This simple experiment will tell you Compound Event when you click button
""")
numbers_input_4 = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 3, 4, 5):", key="numbers_input_4")
if numbers_input_4:
parts=numbers_input_4.split(",")
list1=[]
for i in parts:
i = i.strip()
if i.isdigit():
list1.append(int(i))
set1 = [i for i in list1 if i % 2 == 0]
st.write(f"Event: Rolling a die and getting even number:{set1}")
st.subheader("Impossible Event")
st.markdown("""An Event is said to be impossible event when there is no chance of occuring desired event""",unsafe_allow_html=True)
st.title("Example of Imposible Event")
st.write("""
This simple experiment will tell you Impossible Event when you click button
""")
numbers_input_5 = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 3, 4, 5):", key="numbers_input_5")
if numbers_input_5:
parts=numbers_input_5.split(",")
list1=[]
for i in parts:
i = i.strip()
if i.isdigit():
list1.append(int(i))
set1 = [i for i in list1 if i >6]
st.write(f"Event: Rolling a die and getting number gretaer than 6:{set1}")
st.write(f"The above event is empty because there is no chance that event will happen")
st.subheader("Independent Events")
st.markdown("""An event is said to be independent event when the probability of occurance of one event doesnot effect the probability of other event.""",unsafe_allow_html=True)
st.title("Tossing a coin and Rain prediction.")
st.write("""
This simple experiment will tell you Independent Event when you click button
""")
Trail_6 = st.number_input("Number of Trials:", min_value=1, max_value=100, value=7,key="Trail_6")
if st.button('Start the Experiment: Will it Rain or Not? and Tossing a Coin',key="start_experiment_5"):
st.write(f"Running {Trail_6} trials...")
list1=[]
list2=[]
for i in range(1, Trail_6 + 1):
result = random.choice(['Rain', 'No Rain'])
result1= random.choice(['Head','Tail'])
list1+=[result]
list2+=[result1]
p_rain_1=1/len(np.unique(list1))
p_no_rain_1=1/len(np.unique(list1))
p_head=1/len(np.unique(list2))
p_tail=1/len(np.unique(list2))
st.write(f"Event_1:Probability of having rain:{p_rain_1}")
st.write(f"Event_2:Probability of getting head:{p_head}")
st.subheader("Dependent Event")
st.markdown("""An event is said to be dependent event ,if the probability of occurance of one event effects the probability of another event.
""",unsafe_allow_html=True)
st.title("Randomly picking a ball with replacement.")
st.write("""
This simple experiment will tell you Dependent Event when you click button
""")
red_balls = st.number_input("Number of Red Balls:", min_value=1, max_value=10, value=5)
blue_balls = st.number_input("Number of Blue Balls:", min_value=1, max_value=10, value=5)
total_balls = red_balls + blue_balls
if st.button("Pick a Ball"):
picked_ball = random.choices(['Red', 'Blue'], weights=[red_balls, blue_balls])[0]
if picked_ball == 'Red':
red_balls -= 1
elif picked_ball == 'Blue':
blue_balls -= 1
total_balls = red_balls + blue_balls
st.write(f"You picked a {picked_ball} ball.")
st.write(f"Remaining balls: {red_balls} Red, {blue_balls} Blue.")
p_r=round(red_balls / total_balls,2)
p_b=round(blue_balls / total_balls,2)
st.write(f"Probability of picking Red next: {p_r}")
st.write(f"Probability of picking Blue next: {p_b}")
st.subheader("Exclusive Event")
st.markdown("""An event is said to be exclusive event when both of the event cannot occur at the same time""",unsafe_allow_html=True)
st.write(f"EVENT: Getting head and tail once.Here both of the event cannot occur same time")
st.subheader("Certain Event")
st.markdown("""An event is said to be certain event when the probablity of happening of event is 1 """,unsafe_allow_html=True)
st.write(f"EVENT: Getting either head or tail.")
|