how to print a form in twig where a variable number of form elements have been printed already? I am using a Twig template to render a form that has a variable number of elements.
Each element's key in the form is sequential integer.
So in my template, I can do this:
{% for item in form|children %}
  {{ item }}
{% endfor %}

However, then I have a broken form, because there's no &lt;FORM&gt; HTML element, or the form ID for submission.
I've looked at twig templates for forms in core, but they all work with fixed elements, so they're able to do something like this, seen in modules/content_moderation/templates/entity-moderation-form.html.twig:
{{ form|without('current', 'new_state', 'revision_log', 'submit') }}
If you look at form.html.twig in the Drupal Core's system module, you'll see:
{#
/**
 * @file
 * Default theme implementation for a 'form' element.
 *
 * Available variables
 * - attributes: A list of HTML attributes for the wrapper element.
 * - children: The child elements of the form.
 *
 * @see template_preprocess_form()
 *
 * @ingroup themeable
 */
#}
&lt;form{{ attributes }}&gt;
  {{ children }}
&lt;/form&gt;

Using this as a guide, you should be able to do:
&lt;form{{ attributes }}&gt;
  {% for item in form|children %}
    {{ item }}
  {% endfor %}
&lt;/form&gt;

children is already a variable in the template so you can just use it like:
&lt;form{{ attributes }}&gt;
  {% for item in children %}
    {{ item }}
  {% endfor %}
&lt;/form&gt;

But if you're not wrapping the individual children, why even use a custom template? Why not just use the default form.html.twig.