+ 6
How I would do it: 1.Make a input and a button in which you write names and then ENTER to register the name. 1.5Make an input in which you write the number of groups you want, maybe? 2.After you press enter, the string from the input is written at the end of a array(with push()), 3.You need a function to shuffle the array's content. You can easily find one if you search on google. 4.Check the length of the array, then / it to the number of groups. If it's not a full number, you can add one more name in the last group. 5.Make an emtpy array, and inside it, place all the arrays (groups) made out of the names. At the end, you should have something like: let groups = [["name","name","name"], ["name","name","name"], ["name","name","name"]] I described this for js. I hope it's useful. I don't have time to do the code :/
6th Aug 2022, 4:08 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 4
this input has to be converted to integer: >>> numberOfPeople = (input("How many people are there?")) >>> the second issue is that after giving input for number of groups and number of people the code runs in an infinite loop and starts asking again for the already given numbers ... to avoid this, all code from and including: if groupSize % 2 != 0: ... run = False should be moved 1 indentation level to the right. after this the code is running
7th Aug 2022, 6:22 AM
Lothar
Lothar - avatar