Feature update – rank-order questions
Rank-order questions are used in those cases when you want the users of your program to reorder a set list of options by dragging and dropping them. For example:
- to express preference
- to rearrange a list by the size of the items in it
- any time you want the users choose the order in which the elements of a list are arranged.
In order to create a rank-order question, you need to indent *type:ranking
under the *question
and provide the list to rank:
Letβs look at an example of how rank-order questions work:
*question: Enter the books that you read last month:
*tip: Type one book per line
*multiple
*save: booksRead
*question: Order the books that you read by the time it took you to read them:
*tip: The book that took the longest should be up top
*answers: booksRead
*save: orderedBooks
*type: ranking
The first question asks users to type in a list of the books they read that month. Their answer is saved in the variable booksRead
.
In the case shown above, the value of booksRead
would be:booksRead = ["A Room of One's Own", "Catch-22", "Demon Copperhead", "One Flew Over the Cuckoo's Nest"]
The second question is the rank-order one, where booksRead
is displayed and the user has instructions to reorder them.
If they clicked Next after reordering them as shown, the value of orderedBooks would be.orderedBooks = ["Demon Copperhead", "One Flew Over the Cuckoo's Nest", "A Room of One's Own", "Catch-22"]
Note that, although both collections have the same elements, they are different because the elements are in different order.