Spaces:
Sleeping
Sleeping
| import marimo | |
| __generated_with = "0.9.31" | |
| app = marimo.App() | |
| def __(mo): | |
| mo.md(r"""# Secret Santa""") | |
| return | |
| 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 | |
| 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} | |
| """ | |
| ) | |
| def __(): | |
| import marimo as mo | |
| return (mo,) | |
| if __name__ == "__main__": | |
| app.run() | |