BarBar288 commited on
Commit
231fb18
·
verified ·
1 Parent(s): 7c99ca8

Update app.py

Browse files

//LOG_ 111524_c
ewhghirethoiewoiretuoire
//endlog
/commit

Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -47,11 +47,15 @@ class WheelOfNames:
47
  random.shuffle(names_copy)
48
 
49
  groups = []
50
- while names_copy:
51
  group = names_copy[:group_size]
52
  groups.append(group)
53
  names_copy = names_copy[group_size:]
54
 
 
 
 
 
55
  # Join groups into a single string
56
  groups_text = "\n".join(f"Group {i}: {', '.join(group)}" for i, group in enumerate(groups, 1))
57
  st.session_state.groups_text = groups_text
 
47
  random.shuffle(names_copy)
48
 
49
  groups = []
50
+ while len(names_copy) >= group_size:
51
  group = names_copy[:group_size]
52
  groups.append(group)
53
  names_copy = names_copy[group_size:]
54
 
55
+ # If there are any remaining names, form a smaller group
56
+ if names_copy:
57
+ groups.append(names_copy)
58
+
59
  # Join groups into a single string
60
  groups_text = "\n".join(f"Group {i}: {', '.join(group)}" for i, group in enumerate(groups, 1))
61
  st.session_state.groups_text = groups_text