The task is to load a file which contains some questions with different number of answers and the 1st listed answer is always the correct one
e.g.:
Who is Jane?
Girl
Boy
Both
Why are we here?
Because
For fun
So I was thinking I'll read lines into an array but in the end I need to be able to shuffle the answers for each question(and somehow keep the track of the correct one) and then shuffle the questions also.
So if i read the lines into the array it would look like this:
a = ['Who is Jane?', 'Girl', 'Boy', 'Both', 'Why are we here?', 'Because', 'For fun']
and now I think for what I have to do it would be best to split the arrays into smaller ones that contains always question and all its answers. So I would have something like
test = [['Who is Jane?', 'Girl', 'Boy', 'Both'], ['Why are we here?', 'Because', 'For fun']]
Anyone knows how could I do this?
I know that to access the questions mark you can use a[0][-1]
and that will give you the question mark from 'Who is Jane'
.