名前と人数からグループをランダムに作る関数をPythonで書いてください。
names = ["John", "Paul", "George", "Ringo"]
num_groups = 4
def random_group_maker(names, num_groups):
  
  # Initialize the empty lists 
  groups = [[] for i in range(num_groups)]
  
  # Shuffle the names
  random.shuffle(names)
  
  # Add each name to a group
  group_index = 0
  for name in names:
      groups[group_index].append(name)
      group_index += 1
      if group_index == num_groups:
          group_index = 0
  
  # Return the created groups
  return groups