Spaces:
Sleeping
Sleeping
| 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.") | |