World_of_Statistics / pages /2_Events.py
DOMMETI's picture
Update pages/2_Events.py
d30ed8a verified
raw
history blame
3.52 kB
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")
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.")
st.title("Example of Compound Event")
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}")