File size: 1,031 Bytes
5c60f5b
 
65286f6
5c60f5b
 
 
 
 
65286f6
5c60f5b
 
 
 
65286f6
 
 
5c60f5b
65286f6
5c60f5b
65286f6
 
5c60f5b
65286f6
5c60f5b
 
65286f6
5c60f5b
 
 
65286f6
 
5c60f5b
65286f6
 
5c60f5b
65286f6
 
5c60f5b
 
65286f6
 
5c60f5b
65286f6
5c60f5b
 
 
 
 
 
65286f6
5c60f5b
65286f6
5c60f5b
 
 
 
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
import marimo

__generated_with = "0.9.31"
app = marimo.App()


@app.cell
def __(mo):
    mo.md(r"""# Secret Santa""")
    return


@app.cell
def __input_names_a(mo):
    names_A = mo.ui.text(placeholder="A,B,C...")
    names_B = mo.ui.text(placeholder="A,B,C...")

    # Create shuffle button with conditional enabling
    mo.md(
        f"""
        Enter a comma-separated list of names for the 1st group: {names_A}

        Enter a comma-separated list of names for the 2nd group: {names_B}
        """
    )
    return names_A, names_B


@app.cell
def __(mo, names_A, names_B):
    from random import shuffle

    aa = list([name.strip() for name in names_A.value.split(",") if name.strip()])
    bb = list([name.strip() for name in names_B.value.split(",") if name.strip()])

    shuffle(aa)
    shuffle(bb)

    mo.md(
        f"""
        Shuffled 1st group: {aa}

        Shuffled 2nd group: {bb}
        """
    )


@app.cell
def __():
    import marimo as mo

    return (mo,)


if __name__ == "__main__":
    app.run()