How should an array like python3 form a string

[
["multiple-choice", "multiple-choice", "multiple-choice text", "single-choice"],
["1","1","1","1","2", "text","3"],
[0.0jue 1.0,1.0,0.00.0, 0.0jor1.0,
[0,0,0.0,0.0,0.0,0.0recollection 1.0],
] < text 2.0,2.0]

1 ^ 2 | 3} 2 $2 ^ text 2} 3} 2
1 ^ 2 | 3} 2 $2 ^ text 2} 3 ^ 2

0.0 means no answer is selected, 1.0 indicates that the answer is selected, and the last two arrays are circular.

["multiple-choice", "multiple-choice", "multiple-choice text", "single-choice"],
["1","1","1","1","2", "text","3"], the two arrays are fixed, representing four questions of the first question, the second question and the text. In the third question, there is only one 3

.

for example, judge

by the type of question.

the first question: 0.0,1.0,1.0,0.0 corresponds to 1 minute 2 | 3}

the second question chooses 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 2. "text 2}, corresponding to 2 $2 ^ text 2}.

the third question is chosen, 2.0 corresponds to 3. 2

I really can"t figure out how to compose a string of characters 2} 3} 2 from these arrays. Please do me a favor or give me some ideas

.
Mar.16,2021

what I understand and an idea:

problem = [
    ['', '', '', '', '', '', '', ''],
    ['1', '1', '1', '1', '2', '2', '', '3'],
    [0.0, 1.0, 1.0, 0.0, 0.0, 1.0, '2', 2.0],
    [1.0, 1.0, 1.0, 0.0, 0.0, 1.0, '3', 3.0],
]


rule = problem[0]
nums = problem[1]
answers = problem[2:]


def generate_answer_string(answer):
    answer_string = ''
    index = 0
    rule_length = len(rule)
    while index < rule_length:
        question_type = rule[index]
        question_num = nums[index]
        -sharp  + '$'
        answer_string += question_num + '$'

        -sharp 
        if question_type == '':
            for i in range(4):
                if answer[index] == 1.0:
                    answer_string += str(i + 1) + '|'
                index += 1
            answer_string = answer_string.rstrip('|')
        -sharp 
        elif question_type == '':
            for i in range(2):
                if answer[index] == 1.0:
                    answer_string += str(i + 1)
                index += 1
            answer_string += '^' + answer[index]
            index += 1
        -sharp 
        elif question_type == '':
            answer_string += str(int(answer[index]))
            index += 1

        -sharp  '}'
        answer_string += '}'
    return answer_string


for answer in answers:
    -sharp  '}'
    answer_string = generate_answer_string(answer).rstrip('}')
    print(answer_string)
Menu