File size: 2,494 Bytes
b1e334c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import random

# Define the dictionary lists for each organ
HEART_LIST = [
    {"name": "Heartbeat", "description": "The rhythmic contraction and expansion of the heart", "emoji": "❀️"},
    {"name": "Blood vessels", "description": "The network of tubes that carry blood throughout the body", "emoji": "🧭"},
    {"name": "Pulse", "description": "The rhythmic expansion and contraction of an artery as blood flows through it", "emoji": "πŸ”Š"}
]

LUNG_LIST = [
    {"name": "Breathing", "description": "The act of inhaling and exhaling air", "emoji": "🌬️"},
    {"name": "Respiration", "description": "The process by which oxygen is taken in and carbon dioxide is expelled", "emoji": "πŸ’¨"},
    {"name": "Coughing", "description": "A reflex action that helps to clear the airways", "emoji": "🀧"}
]

BRAIN_LIST = [
    {"name": "Memory", "description": "The ability to store and retrieve information", "emoji": "🧠"},
    {"name": "Concentration", "description": "The ability to focus on a task or idea", "emoji": "πŸ‘€"},
    {"name": "Imagination", "description": "The ability to create mental images or ideas", "emoji": "🌈"}
]

# Define a function to roll a 100 sided dice 10 times and return the rolls and the total score
def roll_dice():
    rolls = [random.randint(1, 100) for _ in range(10)]
    total_score = sum(rolls)
    return rolls, total_score

# Define the Streamlit app
def app():
    st.sidebar.title("Choose an organ list")
    organ_list = st.sidebar.selectbox("Select an organ", ["Heart", "Lung", "Brain"])

    st.write(f"## {organ_list} List")

    if organ_list == "Heart":
        selected_list = HEART_LIST
    elif organ_list == "Lung":
        selected_list = LUNG_LIST
    else:
        selected_list = BRAIN_LIST

    st.write("### Choose an item from the list")
    selected_item = st.selectbox("Select an item", [item["name"] for item in selected_list])
    selected_item_dict = [item for item in selected_list if item["name"] == selected_item][0]

    st.write(f"### {selected_item_dict['name']} {selected_item_dict['emoji']}")
    st.write(selected_item_dict['description'])

    st.write("### Roll the dice")
    rolls, total_score = roll_dice()
    st.write("Rolls:", rolls)
    st.write("Total score:", total_score)

    st.write("### Aggregated score")
    scores = [roll_dice()[1] for _ in range(10)]
    st.write("Scores:", scores)
    st.write("Total score:", sum(scores))

if __name__ == '__main__':
    app()