World_of_Statistics / pages /Random_Variable.py
DOMMETI's picture
Update pages/Random_Variable.py
154cf63 verified
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("Random Variable")
st.markdown("""Random Variable is a function to which the input is sample space and the output should be mapped with real values by using logic""",unsafe_allow_html=True)
st.write("Random Varible is denoted by capital X")
st.title("Kethura Mood's")
st.write("""
This simple experiment will tell you Random Variable when you click button
""")
Trail_7 = st.number_input("Trial:", min_value=1, max_value=100, value=50,key="Trail_7")
if st.button("Kethura's mood"):
st.write(f"No_of_trails{Trail_7}")
list1=[]
for i in range(1,Trail_7+1):
selected_moods = np.random.choice(['Angry', 'Sad', 'Very Happy', 'Depression', 'Excited'])
list1+=[selected_moods]
unique_moods = np.unique(list1)
mood_mapping = {}
count=0
for i in unique_moods:
count=count+1
mood_mapping[i] = count
st.write("Sample Space")
st.write(unique_moods)
st.write("X")
st.write(mood_mapping)
st.write(f"p(X==1) is 1/5")