def gen_input_code(question, id):
    """
    Returns the html code for rendering the appropriate input
    field for the given question.
    Each question is identified by name=id
    """
    qtype = question['type']
    if qtype == 'text':
        return """<input type="text" class="ui text" name="{0}"
                         placeholder="your answer..." />""".format(id)
    elif qtype == 'code':
        return '<textarea class="ui text" name="{0}"></textarea>'.format(id)
    else:
        button_template = '<input type="radio" name="{0}" value="{1}"> {1}<br>'
        code = '' 
        for choice in question['choices']:
            code = code + button_template.format(id, choice)
        return code