import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt import random st.markdown(""" """, 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")